How to use the mongodb-language-model.accepts function in mongodb-language-model

To help you get started, we’ve selected a few mongodb-language-model examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mongodb-js / query-parser / lib / index.js View on Github external
module.exports.isFilterValid = function(input) {
  if (isEmpty(input)) {
    return DEFAULT_FILTER;
  }
  try {
    const parsed = parseFilter(input);

    // is it a valid MongoDB query according to the language?
    return queryLanguage.accepts(EJSON.stringify(parsed)) ? parsed : false;
  } catch (e) {
    debug('Filter "%s" is invalid', input, e);
    return false;
  }
};

mongodb-language-model

Parses MongoDB query language and returns an abstract syntax tree

SSPL
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular mongodb-language-model functions