MongoDB Node.js Driver
Mục lục bài viết
Introduction
The official MongoDB Node.js driver allows Node.js applications to connect to MongoDB and work with data.
The driver features an asynchronous API which allows you to interact with MongoDB using Promises or via traditional callbacks.
Features
- MongoDB Driver
-
Whether you are new to MongoDB or you just want to brush up on the core concepts, you can check out the Fundamentals section which features material on using the Node.js driver for the following:
- Connection Guide: connect to a MongoDB instance or replica set
- Authentication: configure authentication and log a user in
- CRUD Operations: read and write data to MongoDB
- Promises and Callbacks: access return values using asynchronous Javascript
- Indexes: create and design indexes to make your queries efficient
- Collations: apply language-specific sorting rules to your query results
- Logging: configure the driver to log MongoDB operations
- Monitoring: configure the driver to monitor MongoDB server events
Quick Start
Given that you have created your own project using `npm init` we install the mongodb driver and it’s dependencies by executing the following `NPM` command.
npm install mongodb --save
This will download the MongoDB driver and add a dependency entry in your `package.json` file.