Get Started with MongoDB on the Localhost

In this post, we have discussed the steps required to get started with MongoDB on the localhost.

  • Download and install MongoDB from the official website.
  • In root of C directory create a folder named data and inside that folder create a new folder named db
  • Now cd into folder C:\Program Files\MongoDB\Server\4.2\bin using command prompt and run the command: mongod
  • Similarly cd into folder C:\Program Files\MongoDB\Server\4.2\bin using another command prompt and run the command: mongo
  • Now inside the second command prompt, run the command db and you will see a test DB.
  • Go into “Advanced System Settings -> Environment Variables -> Path(Under System Variables) -> Edit” and add new path i.e. C:\Program Files\MongoDB\Server\4.2\bin (change your version accordingly)
  • Now you can run the commands mongod and mongo from any directory.
  • That’s it. Now we can use MongoDB Compass to manage our MongoDB databases.

Leave a Comment

Your email address will not be published.