MongoDB Installation

Here’s a step-by-step guide to install MongoDB on various operating systems:


For Windows:

  1. Download MongoDB:

  2. Install MongoDB:

    • Run the downloaded .msi installer.
    • Follow the setup wizard:
      • Choose "Complete" setup.
      • Ensure "Install MongoDB as a Service" is selected.
  3. Set up MongoDB directory:

    • By default, MongoDB stores data in C:\Program Files\MongoDB\Server\<version>\data.
    • Create a data\db directory in C:\ if it doesn’t exist: C:\data\db.
  4. Start MongoDB:

    • Open a command prompt and type: mongod
    • This starts the MongoDB server.
  5. Connect to MongoDB:

    • Open another command prompt and type: mongo
    • This starts the MongoDB shell.