đź“ť Edit page
âž• Add page
CLI
Mongo server
Start the MongoDB server as a “daemon” background process.
$ mongod
Or configure it to run as a background service on your machine.
See the Installation instructions on the Mongo docs for your OS for parameters to use.
The manual commands are also specific to OS and chip, so are not covered here.
MongoDB shell
See mongosh docs.
The MongoDB shell is an interactive JavaScript interface that allows you to interact with MongoDB databases, collections, and documents.
If the server above is running, you can start without parameters:
$ mongosh
For a cloud deployment, you can use connection string. Example based on the docs:
$ mongosh "mongodb+srv://mycluster.abcd1.mongodb.net/myFirstDatabase" --apiVersion 1 --username <username>
Then use the help
command in the interactive shell for commands. See also the Basic operations cheatsheet.