Return null when findOne could not find record, closes #128

This commit is contained in:
Anatoliy Chakkaev 2013-01-22 23:47:14 +07:00
parent 0096c94d8f
commit cefd79dbf6
1 changed files with 1 additions and 1 deletions

View File

@ -381,7 +381,7 @@ AbstractClass.findOne = function findOne(params, cb) {
}
params.limit = 1;
this.all(params, function (err, collection) {
if (err || !collection || !collection.length > 0) return cb(err);
if (err || !collection || !collection.length > 0) return cb(err, null);
cb(err, collection[0]);
});
};