MongoDB - quick reference

Aus Carl-Christian Sautter - Wiki
Wechseln zu: Navigation, Suche

CLI

Start command line Interface

mongo

Show Databases

show dbs
show databases

Switch to Database

use db

Show Collections

show collections
show tables

List some entries in Collection

db.collection.find()

List some entries and limit amount

db.collection.find().limit(1)

List some entries, limit and sort

db.collection.find().limit(5).sort( { name: 1 } )