1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-24 01:22:10 +02:00
tldr/pages/common/mongo.md
bl-ue 8ebd171d6f
*: fix typos reported by Hunspell (#5848)
Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com>
Co-authored-by: Seth Falco <seth@falco.fun>
Co-authored-by: Patrice Denis <patricedenis@users.noreply.github.com>
2021-05-20 16:13:41 -04:00

20 lines
554 B
Markdown

# mongo
> MongoDB interactive shell client.
> More information: <https://docs.mongodb.com/manual/reference/program/mongo>.
- Connect to a database:
`mongo {{database}}`
- Connect to a database running on a given host on a given port:
`mongo --host {{host}} --port {{port}} {{database}}`
- Connect to a database with a given username; user will be prompted for password:
`mongo --username {{username}} {{database}} --password`
- Evaluate a JavaScript expression on the database:
`mongo --eval '{{JSON.stringify(db.foo.findOne())}}' {{database}}`