The official MongoDB driver is mongodb for Node.js apps. It is a high-level API, built on top of the MongoDB Core driver, mongodb-core, a low-level API. The former is made for end users, while the latter is made for MongoDB library developers. mongodb contains abstractions and helpers that make MongoDB connections, CRUD operations, and authentication easy, while mongodb-core only contains the basic management of MongoDB topology connections, core CRUD operations, and authentication.
For more information about these two packages, visit the following sites:
- https://www.npmjs.com/package/mongodb for the MongoDB driver
- https://www.npmjs.com/package/mongodb-core for the MongoDB Core driver
- http://mongodb.github.io/node-mongodb-native/3.0/api/ for the MongoDB driver API
We can install the MongoDB driver with npm:
$ npm i mongodb
Next, we will look into how we can use it with a quick example in the coming section.