Follow these steps in order to install MongoDB Community Edition on Windows:
- Learn how to open a Windows Command Prompt. Gitbash will not work for MongoDB.
- Read the MongDB Prerequisites (i.e., system requirements).
- Install MongoDB Community Edition.
- Run MongoDB Community Edition from the Command Prompt.
Notes on running MongoDB::
- You create the database directory once– you do not repeat this step each time you start MongoDB.
- You start the MongoDB database server (aka, mongod) in its own command prompt window.
- You start the MongoDB shell (aka, mongo) in a second command prompt window.
Start/Stop mongod (the MongoDB Server)
To start the MongoDB server (aka daemon, hence mongod):
Open a Windows Command Prompt window.
To start the server:"C:\Program Files\MongoDB\Server\4.0\bin\mongod.exe" --dbpath=c:\data\dbTo stop the server: type
ctrl-c
Start/Stop mongo (the MongoDB Shell)
MongoDB includes a CLI, or shell. The shell program is named mongo.
Start mongod, as described above.
Open a new Windows Command Prompt window.
To start the shell:"C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe"To stop the shell: type
ctrl-c
Rather than typing the entire path to the .exe file, like this:
C:\Program Files\MongoDB\Server\4.2\bin\mongo.exeBy adding C:\Program Files\MongoDB\Server\4.2\bin to your PATH environment variable, you can just type this: mongo
Read how to set it up here:
Next Up: Learn Mongo
Next, learn how to use MongoDB.
For Further Information
Read, Install MongoDB Community Edition on Windows.