creating mongodb on windows

step by step guide to how to get windows version and install it locally – ideal for learning how to use mongodb or to use as a development resource.

  1. download from mongo – https://www.mongodb.com/try/download/community
  2. download mongosh (shell interface to mongodb) – https://www.mongodb.com/try/download/shell
  3. download mongodb compass (UI interface to the database) – https://www.mongodb.com/try/download/compass
  4. install the server and shell to their own sub folders – e.g. c:\mongo\*
  5. create sub directories in the server for:
    • DATA
    • LOGS
    • CONFIG
  6. Inside the CONFIG folder create a cfg file which will be used to store the configuration of the server. Initially do not setup security as you will need to create the super admin user before enabling security.
  7. < to be completed – link to sample config files>.
  8. Also note, there are several gotchas in creating config files:
    • use two spaces instead of tabs to indent config elements
    • use double backslash \\ as the windows file separator.
  9. Install the service with reference to the config file by running this on the command line:
    • mongod --config C:\mongo\mongo-server\CONFIG\mongod.cfg --install
  10. Start the service using UI or PowerShell command
  11. Connect to the service with the mongo shell application and create a super admin user (https://www.mongodb.com/docs/manual/reference/method/db.createUser/)
  12. edit the configuration file and set security.authorization to enabled
  13. restart the mongo service
  14. use the shell to connect with the service – you should not see the security warning about unrestricted access anymore.
  15. Mongo is now setup!!!

Comments

Leave a Reply