.msi
installer.brew tap mongodb/brew
brew install mongodb-community@6.0
brew install mongodb-community@6.0
For Linux (Ubuntu/Debian-based systems):
Open Terminal and run the following commands:
sudo apt update
sudo apt install -y mongodb
Once installed, check if MongoDB is running properly:
mongod --version
mongod --version
net start MongoDB
macOS & Linux:
sudo systemctl start mongod
To connect to MongoDB, use the mongo
shell:
mongo
You should now see the MongoDB shell ready for use.
Let's create a database and insert data:
use myDatabase
db.users.insertOne({ name: "John Doe", age: 30 })
db.users.find()
This will create a database myDatabase
and insert a user document.
You have successfully installed MongoDB and set up your first database. You can now start building applications with MongoDB! 🚀