Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Installing MongoDB
interview

Q1. How do you install MongoDB on Windows?
Download the MongoDB installer from the official MongoDB website (mongodb.com). Run the .msi file, choose 'Complete' setup, and optionally install MongoDB Compass. During installation, you can choose to install MongoDB as a service. After installation, add the MongoDB bin directory to your PATH environment variable and verify with
mongod --version

Q2. How do you install MongoDB on macOS?
The easiest way is using Homebrew:
brew tap mongodb/brew brew install mongodb-community
After installation, start MongoDB as a service:
brew services start mongodb-community

Q3. How do you install MongoDB on Linux (Ubuntu)?
Import the MongoDB public key and add the repository:
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Then install:
sudo apt-get update sudo apt-get install -y mongodb-org

Q4. How do you start and stop MongoDB service?
On Linux/macOS (if installed via package manager), use systemd or brew:
sudo systemctl start mongod # Linux sudo systemctl stop mongod brew services start mongodb-community # macOS
On Windows, if installed as a service, use
net start MongoDB net stop MongoDB

Q5. How do you verify MongoDB is running?
Open a terminal and connect using the MongoDB shell:
mongosh
If successful, you'll see a prompt. You can also check service status:
sudo systemctl status mongod # Linux