Fixed ReferencesMany .findById to check the given id in the ids array of the model instance

This commit is contained in:
Satyadeep 2015-08-19 22:34:16 +05:30
parent 0381f6d7e7
commit ad83c82ebc
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);
}