Forrest logo
back to context overview

mongo

List of commands for mongo:

  • mongo:collections:show Display all MongoDB collections in the current database.
    $ mongo --quiet --eval 'db.getCollectionNames().forEach(printjson);'
    try on your machine
    explain this command
  • mongo:tldr:385e5 mongo: Evaluate a JavaScript expression on the database.
    $ mongo --eval '${JSON-stringify(db-foo-findOne())}' ${database}
    try on your machine
    explain this command
  • mongo:tldr:46d58 mongo: Connect to a database running on a given host on a given port.
    $ mongo --host ${host} --port ${port} ${database}
    try on your machine
    explain this command
  • mongo:tldr:58e15 mongo: Connect to a database.
    $ mongo ${database}
    try on your machine
    explain this command
  • mongo:tldr:59470 mongo: Connect to a database with a given username; user will be prompted for password.
    $ mongo --username ${username} ${database} --password
    try on your machine
    explain this command
back to context overview