🖥️mongo
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the mongo command with important options and switches using examples.
2 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ███╗ ███╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗
# ████╗ ████║██╔═══██╗████╗ ██║██╔════╝ ██╔═══██╗
# ██╔████╔██║██║ ██║██╔██╗ ██║██║ ███╗██║ ██║
# ██║╚██╔╝██║██║ ██║██║╚██╗██║██║ ██║██║ ██║
# ██║ ╚═╝ ██║╚██████╔╝██║ ╚████║╚██████╔╝╚██████╔╝
# ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝
# mongo
# MongoDB interactive shell client.
# Connect to local host on default port 27017
mongo
# Connect to remote host on specified port
mongo --host 10.121.65.23 --port 23020
# Connect to a database <host>/<database>
mongo 10.121.65.58/mydb
# Connect to a database on specified host and port
# with this username and password
mongo -u username -p password --port 12345 --host localhost
# Run the shell after executing my-script.js
mongo --shell my-script.js
# Connect to database on specified port and host
# and execute my-script.js after that
mongo localhost:27017/myDatabase my-script.js
# Evaluate a javascript expression on the database:
mongo --eval 'JSON.stringify(db.foo.findOne())' database
# See also:
# MongoDB cheat sheets at /mongo/
# list of pages: /mongo/:list
# search in pages: /mongo/~keyword
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command mongo in a clear format. This allows users to quickly access the needed information for mongo without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for mongo are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.