Socket
Book a DemoInstallSign in
Socket

rsql-query-builder-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsql-query-builder-mongodb

Library for building RSQL query strings for MongoDB.

latest
Source
npmnpm
Version
1.3.2
Version published
Maintainers
1
Created
Source

rsql-query-builder-mongodb

Library for building RSQL query strings for MongoDB in TypeScript and JavaScript.

NPM Version NPM License Coverage

Installation

$ npm install rsql-query-builder-mongodb

RSQL Builder for MongoDB Methods

The RSQLBuilderMongoDB class provides many methods to build the desired RSQL string.

Initialization

  • constructor(options) – Initializes a new RSQLBuilderMongoDB instance.

Comparisons Operators (Defining Conditions)

  • equal(selector, value) - Appends a condition selector == value.
  • notEqual(selector, value) - Appends a condition selector != value.
  • lessThan(selector, value) - Appends a condition selector =lt= value.
  • lessThanOrEqual(selector, value) - Appends a condition selector =le= value.
  • greaterThan(selector, value) - Appends a condition selector =gr= value.
  • greaterThanOrEqual(selector, value) - Appends a condition selector =ge= value.
  • in(selector, values) - Appends a condition selector =in= (values).
  • notIn(selector, value) - Appends a condition selector =out= (values).
  • like(selector, regex, options) - Appends a condition selector =regex= value = options.
  • notLike(selector, regex, options) - Appends a condition selector =notregex= value = options.
  • regex(selector, regex, options) - Appends a condition selector =regex= value = options.
  • notRegex(selector, regex, options) - Appends a condition selector =notregex= value = options.

Expression Grouping (Organizing Conditions)

  • group(builder) - Wraps the conditions from another RSQLBuilderMongoDB instance in parentheses for grouping.

Logical Operators (Combining Conditions)

  • and() – Appends the logical AND operator ;.
  • or() - Appends a logical OR operator ,.

RSQL Builder Composition (Combining Multiple RSQL Queries)

  • concat(builder) – Appends all expressions from another RSQLBuilderMongoDB instance to the current instance.
  • merge(builders) – Merges multiple RSQLBuilderMongoDB instances into grouped conditions.

RSQL String Management (Finalizing the Query)

  • toString() - Returns the generated RSQL query string.
  • isEmpty() – Returns true if the RSQLBuilderMongoDB instance has no expressions; otherwise, returns false.
  • reset() – Clears all expressions, resetting the RSQLBuilder instance.

Static Utilities

  • merge(builders) – Creates a new RSQLBuilderMongoDB instance and merges multiple RSQLBuilderMongoDB instances into grouped conditions.

Compatibility

This RSQLBuilder for MongoDB is built to be compatible to the following RSQL query resolver: RSQL MongoDB

License

MIT

Keywords

rsql

FAQs

Package last updated on 01 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.