Check the filter param to make sure we have a default value

sls-sample-app is failing if we hit http://localhost:3000/locations/findOne

In this case, a undefined param is passed in.

The fix now sets it to {} if the value is undefined/null
This commit is contained in:
Raymond Feng 2013-09-06 13:42:12 -07:00
parent be10dfcc18
commit 21e6fddf1a
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);