mongodb-shell – Cheat Sheet

0

mongo

mongo mongodb://<connection>
mongo mongodb://localhost:27017/myDatabase?ssl=true

mongo Commands

help
db.help()
db.<collection>.help()
show dbs
use <db>
show collections
show users
show roles
show profile
show databases
load()

mongodump

# backup data
mongodump --gzip --db "<database>" /out:"<directory>"

mongorestore

# restore data
mongorestore --drop --gzip --uri \ "<uri>" "<directory>"

References

mongo Shell Quick Reference
mongorestore
mongodump 
Share.

About Author

Christian Unnerstall

Christian Unnerstall, founder of devshooin.com, enjoys designing and building things that look nice and work well, whether it's websites or services within the interwebs. Have questions - feel free to reach out to him. Enjoy

Leave a Reply