MongoDB Installation
Here’s a step-by-step guide to install MongoDB on various operating systems:
For Windows:
Download MongoDB:
- Go to the MongoDB download center.
- Select your version, platform (Windows), and package (MSI).
Install MongoDB:
- Run the downloaded
.msi
installer. - Follow the setup wizard:
- Choose "Complete" setup.
- Ensure "Install MongoDB as a Service" is selected.
- Run the downloaded
Set up MongoDB directory:
- By default, MongoDB stores data in
C:\Program Files\MongoDB\Server\<version>\data
. - Create a
data\db
directory inC:\
if it doesn’t exist:C:\data\db
.
- By default, MongoDB stores data in
Start MongoDB:
- Open a command prompt and type: mongod
- This starts the MongoDB server.
Connect to MongoDB:
- Open another command prompt and type: mongo
- This starts the MongoDB shell.