update name as a to newA,but update one record
db.movies.update({name:'a'},{$set:{name:'newA'}})
update all
db.movies.update({name:'a'},{$set:{name:'newA'}},{multi:true})
when save() has _id paramter ,as same as update,otherwise,as insert()
db.movies.save({_id:Object("56461345adsa564"),name:'newA'})
delete all
db.movies.remove({name:'newB'})
delete one
db.movies.remove({name:'newB'},1)
remove all records
db.movies.remove()
restrive specify filed what you want ,1 for yes ,0 for no, default _id is alway exist,can set _id:0
db.movies.find({},{name:1});
restrive two records,if limit method no paramter,will serach all records
db.movies.find().limit(2)
skip
db.movies.find().limit(2).skip(1)
order by filed 1 for Ascending, -1 for descend
db.movies.find().sort({name:-1})
aggregate
db.movies.aggregate([{$group:{'_id':'$name',num:{$sum:1}}}]) find fileld what you want sum or avge and so more
the result is like:
[{_id:'newA',sum:5},
{_id:'newB',sum:1}]
thanks ,that is all foundation ,haha.