Skip to content

Commit

Permalink
mongo: Add page (tldr-pages#994)
Browse files Browse the repository at this point in the history
* mongo: Add page

* Addressing comments
  • Loading branch information
agnivade authored and leostera committed Aug 8, 2016
1 parent 9c5450f commit 0d2e706
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pages/common/mongo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# mongo

> MongoDB interactive shell client.
- 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}}`

0 comments on commit 0d2e706

Please sign in to comment.