Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mquery

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mquery

Expressive query building for MongoDB

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
decreased by-22.01%
Maintainers
2
Weekly downloads
 
Created

What is mquery?

The mquery npm package is a fluent MongoDB query builder designed to run in multiple environments. It provides a chainable interface for building queries and allows for the construction and manipulation of MongoDB queries with a more readable and convenient syntax.

What are mquery's main functionalities?

Building Queries

Allows for the construction of MongoDB queries using a chainable syntax. For example, to find all documents where the age field is greater than 21 and limit the results to 10 documents, you can use the following code: `mquery().find({ age: { $gt: 21 } }).limit(10)`.

{"find": {"age": {"$gt": 21}}, "limit": 10}

Query Execution

Executes the built query against a MongoDB collection. The `exec` method takes a callback function that will be called with the results of the query. For example: `mquery().find({ name: 'John Doe' }).exec(callback)`.

{"exec": "function(callback) { return this._collection.find(this._conditions, this._fields, this._options, callback); }"}

Updating Documents

Provides methods for updating documents in a MongoDB collection. For instance, to update the name field of all documents matching certain conditions, you can use: `mquery().update({ name: 'John Doe' }, { $set: { name: 'Jane Doe' } }).exec(callback)`.

{"update": {"$set": {"name": "Jane Doe"}}, "exec": "function(callback) { return this._collection.update(this._conditions, this._update, this._options, callback); }"}

Removing Documents

Allows for the removal of documents from a MongoDB collection. To remove documents that match certain conditions, you can use: `mquery().remove({ age: { $lt: 18 } }).exec(callback)`.

{"remove": "function(callback) { return this._collection.remove(this._conditions, this._options, callback); }"}

Other packages similar to mquery

Keywords

FAQs

Package last updated on 23 Feb 2023

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc