Converts RSQL (RESTful Service Query Language) / FIQL query strings into MongoDB query filter objects. v3.0.2 supports comparison operators (=gt=, =lt=, =in=, etc.), logical operators (; for AND, , for OR), parenthesized grouping, regex matching, and automatic type coercion for strings, numbers, booleans, dates, and ObjectId. Released under MIT license. Lightweight, no external dependencies, ships TypeScript definitions.
npm install rsql-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a complex RSQL query string with logical operators into a MongoDB filter object.
Ensure date strings are in ISO 8601 format (e.g., '2023-10-21T00:00:00.000Z') to avoid ambiguous interpretation.
If not intended, wrap the value in quotes to force string type: _id=="650a7389a7ab39ddcfbc6832"
Use =regex= and =notregex= instead.
Escape characters: \(, \), \;, \,
Check for null before passing to MongoDB find() — passing null is equivalent to no filter.
Validate the RSQL string with a parser tool or ensure correct bracket pairing and operator usage.
Use default import: import rsql from 'rsql-mongodb' or const rsql = require('rsql-mongodb');Ensure you are using a recent MongoDB driver that supports $regex.
Run npm install rsql-mongodb
No dependency data recorded yet.