Merge pull request #11 from strongloop/findone-failure
Check the filter param to make sure we have a default value
This commit is contained in:
commit
0d303de917
|
@ -469,6 +469,7 @@ DataAccessObject.findOne = function findOne(params, cb) {
|
||||||
cb = params;
|
cb = params;
|
||||||
params = {};
|
params = {};
|
||||||
}
|
}
|
||||||
|
params = params || {};
|
||||||
params.limit = 1;
|
params.limit = 1;
|
||||||
this.find(params, function (err, collection) {
|
this.find(params, function (err, collection) {
|
||||||
if (err || !collection || !collection.length > 0) return cb(err, null);
|
if (err || !collection || !collection.length > 0) return cb(err, null);
|
||||||
|
|
Loading…
Reference in New Issue