Array
University of Oregon

Install MongoDB (Windows)

Follow these steps in order to install MongoDB Community Edition on Windows:

  1. Learn how to open a Windows Command Prompt. Gitbash will not work for MongoDB.
  2. Read the MongDB Prerequisites (i.e., system requirements).
  3. Install MongoDB Community Edition.
  4. 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\db

To 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.exe

By 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.


 

Skip to toolbar