Compiles PivotQL ASTs into MongoDB query objects. This library is part of the PivotQL ecosystem, a DSL for filtering and querying data structures. Current stable version is 0.4.2, released as an alpha. It is designed for Node.js environments that use MongoDB. Key differentiators: allows writing expressive, SQL-like filter syntax that gets transpiled into MongoDB's native query language. Minimal dependencies; relies on the PivotQL parser and MongoDB driver. Suitable for APIs where user-defined filters need to be safely converted to MongoDB queries.
npm install pivotql-compiler-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a PivotQL expression string into an AST and compiles it to a MongoDB query object.
Always parse your query string with the pivotql-parser-expression first, then pass the result to compile.
Use ES module import syntax or set type: "module" in package.json.
Pin to exact version and test upgrades carefully.
Avoid field keys containing dots; they will be treated as nested path separators.
Create a custom declaration file (e.g., globals.d.ts) with `declare module 'pivotql-compiler-mongodb';`
Use `import { compile } from 'pivotql-compiler-mongodb'` correctly.Ensure package version >=0.4.0 and use ESM import. If using bundler, check resolve config.