Download and Install
Install Node and npm
Ensure you have Node.js v16 or later and npm (Node Package Manager) installed in your development environment.
For information on how to install Node.js and npm, see downloading and installing Node.js and npm.
Create a Project Directory
In your shell, run the following command to create a
directory called node_quickstart
for this project:
mkdir node_quickstart
Run the following command to navigate into the project directory:
cd node_quickstart
Run the following command to initialize your Node.js project:
npm init -y
When this command successfully completes, you have a package.json
file in your node_quickstart
directory.
Install the Node.js Driver
Run the following command in your shell to install the driver in your project directory:
npm install mongodb@6.10
This command performs the following actions:
Downloads the
mongodb
package and the dependencies it requiresSaves the package in the
node_modules
directoryRecords the dependency information in the
package.json
file
After you complete these steps, you have Node.js and npm installed and a new project directory with the driver dependencies installed.
Note
If you run into issues on this step, ask for help in the MongoDB Community Forums or submit feedback by using the Rate this page tab on the right or bottom right side of this page.