Merge pull request #648 from fabien/fix/references-many-include
Fix #623 - use actual array order for referencesMany include handling.
This commit is contained in:
commit
72897c9f1a
|
@ -407,6 +407,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
* @param callback
|
||||
*/
|
||||
function includeReferencesMany(callback) {
|
||||
var modelToIdName = idName(relation.modelTo);
|
||||
var allTargetIds = [];
|
||||
//Map for Indexing objects by their id for faster retrieval
|
||||
var targetObjsMap = {};
|
||||
|
@ -461,6 +462,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
relation.modelTo.include(targets, subInclude, options, next);
|
||||
});
|
||||
}
|
||||
targets = utils.sortObjectsByIds(modelToIdName, allTargetIds, targets);
|
||||
//process each target object
|
||||
tasks.push(targetLinkingTask);
|
||||
function targetLinkingTask(next) {
|
||||
|
|
Loading…
Reference in New Issue