Includes with transaction support
This commit is contained in:
parent
d495a26a76
commit
13b9e47e87
|
@ -323,7 +323,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
/**
|
||||
* 1st DB Call of 2 step process. Get through model objects first
|
||||
*/
|
||||
relation.modelThrough.find(throughFilter, throughFetchHandler);
|
||||
relation.modelThrough.find(throughFilter, options, throughFetchHandler);
|
||||
/**
|
||||
* Handle the results of Through model objects and fetch the modelTo items
|
||||
* @param err
|
||||
|
@ -369,7 +369,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
/**
|
||||
* 2nd DB Call of 2 step process. Get modelTo (target) objects
|
||||
*/
|
||||
relation.modelTo.find(filter, targetsFetchHandler);
|
||||
relation.modelTo.find(filter, options, targetsFetchHandler);
|
||||
function targetsFetchHandler(err, targets) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
@ -443,7 +443,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
/**
|
||||
* Make the DB Call, fetch all target objects
|
||||
*/
|
||||
relation.modelTo.find(filter, targetFetchHandler);
|
||||
relation.modelTo.find(filter, options, targetFetchHandler);
|
||||
/**
|
||||
* Handle the fetched target objects
|
||||
* @param err
|
||||
|
@ -505,7 +505,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
inq: uniq(sourceIds)
|
||||
};
|
||||
relation.applyScope(null, filter);
|
||||
relation.modelTo.find(filter, targetFetchHandler);
|
||||
relation.modelTo.find(filter, options, targetFetchHandler);
|
||||
/**
|
||||
* Process fetched related objects
|
||||
* @param err
|
||||
|
@ -595,7 +595,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
return;
|
||||
}
|
||||
relation.applyScope(null, typeFilter);
|
||||
Model.find(typeFilter, targetFetchHandler);
|
||||
Model.find(typeFilter, options, targetFetchHandler);
|
||||
/**
|
||||
* Process fetched related objects
|
||||
* @param err
|
||||
|
@ -660,7 +660,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
inq: uniq(sourceIds)
|
||||
};
|
||||
relation.applyScope(null, filter);
|
||||
relation.modelTo.find(filter, targetFetchHandler);
|
||||
relation.modelTo.find(filter, options, targetFetchHandler);
|
||||
/**
|
||||
* Process fetched related objects
|
||||
* @param err
|
||||
|
@ -727,7 +727,7 @@ Inclusion.include = function (objects, include, options, cb) {
|
|||
inq: uniq(targetIds)
|
||||
};
|
||||
relation.applyScope(null, filter);
|
||||
relation.modelTo.find(filter, targetFetchHandler);
|
||||
relation.modelTo.find(filter, options, targetFetchHandler);
|
||||
/**
|
||||
* Process fetched related objects
|
||||
* @param err
|
||||
|
|
Loading…
Reference in New Issue