Useful Mongoose functions

suggest change

find, findOne, and findById are methods on a model. The name doc below has to be that model. They are not methods on a document you already loaded.

doc.find({'some.value':5},function(err,docs){
    //returns array docs
});

doc.findOne({'some.value':5},function(err,doc){
    //returns document doc
});

doc.findById(obj._id,function(err,doc){
    //returns document doc
});

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents