1.find()
var cursor = collection.find(query, [fields], options);
cursor.sort(fields).limit(n).skip(m). cursor.nextObject(function(err, doc) {}); cursor.each(function(err, doc) {}); cursor.toArray(function(err, docs) {}); cursor.rewind() // reset the cursor to its initial state.
2.insert()
collection.insert(docs, options, [callback]);
Useful options:(*)
safe:true
Should always set if you have a callback.
3.update()
collection.update(criteria, objNew, options, [callback]);
Useful options:(*)
safe:true
Should always set if you have a callback.multi:true
If set, all matching documents are updated, not just the first.upsert:true
Atomically inserts the document if no documents matched.
4.findAndModify()
Useful options:(*)
remove:true
set to a true to remove the object before returningnew:true
set to true if you want to return the modified object rather than the original. Ignored for remove.upsert:true
Atomically inserts the document if no documents matched.