The mongodb installed by npm is just a plug-in for the nodejs program to communicate with mongodb, and mongodb itself needs to be installed by yourself. The installation method is different depending on the system. You can go to the mongodb official website to read the documentation
npm installs the mongodb module of nodeJs. First, you need to install mongodb separately on your computer.
After installation, go to your installation directory and find the bin/ folder. Open the command line and enter mongod --dbpath=/data This directory /data folder needs to be created by yourself.
The mongodb installed by npm is just a plug-in for the nodejs program to communicate with mongodb, and mongodb itself needs to be installed by yourself. The installation method is different depending on the system. You can go to the mongodb official website to read the documentation
Let’s first figure out what
npm
is...https://www.mongodb.com/download-center#community
npm installs the mongodb module of nodeJs. First, you need to install mongodb separately on your computer.
After installation, go to your installation directory and find the bin/ folder. Open the command line and enter mongod --dbpath=/data
This directory /data folder needs to be created by yourself.
nodeJS uses mongooose module
brew install mongodb
or other installation methodsmongoose installation
js code