On this page you find all important commands for the CLI tool mongo. If the
command you are looking for is missing please ask our AI.
mongo
MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and current versions are licensed under the Server Side Public License (SSPL) which is considered non-free by some organizations and distributions. MongoDB is a member of the MACH Alliance.
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 machineexplain this command
-
mongo:tldr:385e5 mongo: Evaluate a JavaScript expression on the database.$ mongo --eval '${JSON-stringify(db-foo-findOne())}' ${database}try on your machineexplain 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 machineexplain this command
-
mongo:tldr:58e15 mongo: Connect to a database.$ mongo ${database}try on your machineexplain this command
-
mongo:tldr:59470 mongo: Connect to a database with a given username; user will be prompted for password.$ mongo --username ${username} ${database} --passwordtry on your machineexplain this command
-
mongodb:query:find Install the Hetzner cloud CLI client$ mongo --eval 'db.${collection}.find(${json_query})'try on your machineexplain this command