How to use the mongodb-query-parser.parseFilter function in mongodb-query-parser

To help you get started, we’ve selected a few mongodb-query-parser 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 / compass-aggregations / src / modules / import-pipeline.js View on Github external
export const createPipeline = (text) => {
  try {
    const jsText = transpiler[SHELL][JS].compile(text);
    const js = parseFilter(jsText);
    return js.map((stage) => {
      return createStage(
        Object.keys(stage)[0],
        toShellString(Object.values(stage)[0], INDENT),
        null
      );
    });
  } catch (e) {
    return [ createStage(null, '', e.message) ];
  }
};

mongodb-query-parser

Parse MongoDB queries

Apache-2.0
Latest version published 3 months ago

Package Health Score

81 / 100
Full package analysis