MongoDB Tutorial
- Home
- Introduction
- Installation
- Connection & Databases
- CRUD Operations
- Comparison Operators
- Logical Operators
- Array Operators
- Evaluation Operators
- Update Operators
- Projection & Sorting
- Cursor Methods
- Querying Nested Docs
- Upserts & Indexes
- Aggregation Framework
- Data Modeling
- Validations & Transactions
- Geospatial Queries
- Advanced Indexing
- MongoDB with Next.js
- Best Practices
MongoDB Installation
You can run MongoDB in two ways: Locally on your machine or in the Cloud using MongoDB Atlas.
1. Local Installation (Windows)
- Download the MongoDB Community Server from the official website.
- Run the `.msi` installer and follow the wizard.
- Select "Install MongoDB as a Service".
- Install MongoDB Compass (recommended GUI) when prompted.
- 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 MongoDB3. MongoDB Atlas (Cloud)
MongoDB Atlas is a fully managed cloud database. It's the easiest way to get started.
- Go to MongoDB Atlas and sign up for a free account.
- Create a Shared Cluster (Free tier).
- Create a Database User (Username & Password).
- Whitelist your IP Address in Network Access.
- 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!
