MongoDB

Start Service

sudo service mongod start


Start mongo terminal

mongo


Show databases

show dbs


Show current database name

db


Show collections in database

show collections


Insert:

db.collection.insert({})


Insert multiple:

db.collection.insert([{1}, {2}])


Select / Find

db.collection.find()

db.collection.find().pretty()

db.collection.find({key:val,key:val})


Update:

db.collection.update({key:val}, {$set: {key:val}}, {multi:true})


Delete:

db.collection.remove({key:val})


Connection with Node.js

npm install mongodb -g

npm link mongodb