difference between Query and Model mongoose difference between Query and Model mongoose mongoose mongoose

difference between Query and Model mongoose


Model.findOne() is the actual way to finding single document from database using findOne() query

whereas Query.prototype.findOne() means prototype of findOne Query

as per documentation : you can pass your filter, projection, options objects and callback function to your query

example :

 Kitten.where({ color: 'white' }).findOne(function (err, kitten) {      if (err) return handleError(err);      if (kitten) {        // doc may be null if no document matched      } });

mongoose have displayed prototypes of all Query you can use to your Model , means what you can pass to your Query while finding documents.