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:
Raymond Feng 2013-09-06 13:50:16 -07:00
commit 0d303de917
1 changed files with 1 additions and 0 deletions

View File

@ -469,6 +469,7 @@ DataAccessObject.findOne = function findOne(params, cb) {
cb = params;
params = {};
}
params = params || {};
params.limit = 1;
this.find(params, function (err, collection) {
if (err || !collection || !collection.length > 0) return cb(err, null);