User Tools

Site Tools


mongodb

MongoDB

Shell : Basic commands

mongo
mongo dbname
show dbs
use dbname
show collections

Create a collection

db.createCollection("collectionName")

List documents in a collection

db.collection.find()
db.collection.find({'id': '210228'})

Add a document into the collection

db.collection.save({country:"England",GroupName:"D"})

Delete all documents of a collection

db.collection.remove({})

Delete a collection

db.collection.drop()

mongodb.txt · Last modified: 2017/12/27 11:38 by jdx