This page shows the driver syntax for several MongoDB commands and links to their related reference and API documentation.
Compatibility
You can use the Node.js driver to connect and execute commands for deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB
To learn more about performing common CRUD operations in the Atlas UI for deployments hosted in MongoDB Atlas, see Create, View, Update, and Delete Documents.
Command | Syntax | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Find a Document | | |||||||||||||||
Find Multiple Documents | | |||||||||||||||
Insert a Document | | |||||||||||||||
Insert Multiple Documents | | |||||||||||||||
Update a Document | | |||||||||||||||
Update Multiple Documents | | |||||||||||||||
Update Arrays in Documents | | |||||||||||||||
Replace a Document | | |||||||||||||||
Delete a Document | | |||||||||||||||
Delete Multiple Documents | | |||||||||||||||
Bulk Write | | |||||||||||||||
Watch for Changes | | |||||||||||||||
Access Data from a Cursor Iteratively | | |||||||||||||||
Access Data from a Cursor as an Array | | |||||||||||||||
Count Documents | | |||||||||||||||
List the Distinct Documents or Field Values | | |||||||||||||||
Limit the Number of Documents Retrieved | | |||||||||||||||
Skip Retrieved Documents | | |||||||||||||||
Sort the Documents When Retrieving Them | | |||||||||||||||
Project Document Fields When Retrieving Them | | |||||||||||||||
Create an Index | | |||||||||||||||
Query Text | | |||||||||||||||
Install the Driver Dependency | package.json |