MongoDB Installation

You can run MongoDB in two ways: Locally on your machine or in the Cloud using MongoDB Atlas.

1. Local Installation (Windows)

  1. Download the MongoDB Community Server from the official website.
  2. Run the `.msi` installer and follow the wizard.
  3. Select "Install MongoDB as a Service".
  4. Install MongoDB Compass (recommended GUI) when prompted.
  5. Add the bin folder (`C:\Program Files\MongoDB\Server\x.x\bin`) to your system Environment Variables (PATH).

2. Running MongoDB as a Service

Once installed, you can start or stop the MongoDB service via the command line (Terminal/PowerShell) as Administrator:

# Start Service
net start MongoDB

# Stop Service
net stop MongoDB

3. MongoDB Atlas (Cloud)

MongoDB Atlas is a fully managed cloud database. It's the easiest way to get started.

  1. Go to MongoDB Atlas and sign up for a free account.
  2. Create a Shared Cluster (Free tier).
  3. Create a Database User (Username & Password).
  4. Whitelist your IP Address in Network Access.
  5. Get your Connection String to use in your application.

4. MongoDB Compass

MongoDB Compass is a GUI that helps you visualize and explore your data. Simply paste your connection string (local or cloud) to connect and start managing your databases.

Next Step: Once you have MongoDB installed or an Atlas account ready, you're prepared to connect and create your first database!