NoSQL#
Table of Contents#
MongoDB#
1
Verify that the Homebrew package manager is installed.
brew --version
2
Installation via Homebrew.
brew tap mongodb/brew
brew install mongodb-community
3
Verify that MongoDB is installed.
mongod --version
mongosh --version
4
List services and their status.
brew services
5
If necessary, startup (or shutdown) the service.
brew services start mongodb-community
brew services stop mongodb-community
6
Enter the MongoDB shell.
mongosh
Getting started with mongosh#
Start the MongoDB shell.
Documentation
mongosh
mongosh "mongodb://localhost:27017"
Documentation
List the current database.
db
List all the databases.
show dbs
Switch to database myDatabase
.
use myDatabase
Show database collections.
show collections
Documentation
Return all documents from collection myCollection
.
db.myCollection.find()
Exit the MongoDB shell.
quit