A library to parse URL query strings into MongoDB query objects. Version 4.1.1 is the latest stable release. It supports basic operators ($eq, $gt, $gte, $lt, $lte, $ne, $in, $nin, $exists, $regex), geospatial operators ($geoWithin, $near), custom query functions (after, before, between), and features like aliased, blacklisted, and whitelisted parameters. It automatically parses numbers and booleans from strings. Useful for building APIs that accept user-specified MongoDB queries via URL parameters. Differentiators: simple syntax for common MongoDB operations, support for geo queries, and built-in aliasing/blacklisting for security.
npm install mongo-querystringNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows using MongoQS with whitelist, blacklist, aliases, and parsing a query string with geospatial near operator.
Use the original parameter name (before alias) in whitelist/blacklist.
If you need different regex options, use the full $regex syntax with a custom parser.
Pass a custom field name in options: `{ geoField: 'location' }`.Use pipe: `?between=2014-01-01|2015-01-01`.
Use const MongoQS = require('mongo-querystring')Install @types/mongo-querystring if available, or create a declaration file: declare module 'mongo-querystring';
Use whitelist: { param: ['value1', 'value2'] } instead of whitelist: ['param'].No dependency data recorded yet.