Merge pull request #699 from satyadeepk/master

Fixed ReferencesMany .findById to check the given id in the modelInstance[fk]
This commit is contained in:
Raymond Feng 2015-08-31 10:08:38 -07:00
commit febfe2362a
1 changed files with 2 additions and 2 deletions

View File

@ -2985,7 +2985,7 @@ ReferencesMany.prototype.findById = function (fkId, options, cb) {
fkId = fkId.toString(); // mongodb
}
var ids = [fkId];
var ids = modelInstance[fk] || [];
var filter = {};
@ -2993,7 +2993,7 @@ ReferencesMany.prototype.findById = function (fkId, options, cb) {
cb = cb || utils.createPromiseCallback();
modelTo.findByIds(ids, filter, options, function (err, instances) {
modelTo.findByIds([fkId], filter, options, function (err, instances) {
if (err) {
return cb(err);
}