Converts MongoDB query objects into optimized JavaScript filter functions for in-memory array filtering. Version 1.0.7 is stable with no active development since 2021. Differentiates from lodash's _.filter by supporting MongoDB query operators like $regex, $geoWithin, and $elemMatch. Lightweight, no dependencies, works in browser and Node.js.
npm install mongo-query-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Compiles a MongoDB query into a filter function and applies it to an array.
Use literal keys with $literal or avoid dots in field names.
Update imports to use compileQuery as default.
Use the expression parameter to pass custom functions.
Bind the filter function to the array if needed, or just pass to .filter() directly.
Wrap it in an object: { field: { $regex: 'pattern' } }No dependency data recorded yet.