Capture includeHasMany() as a find()'s caller by findCaller option

To replace incorrect location of capturing this condition in find() in
loopback-connector/lib/sql.js  proposed earlier in
https://github.com/strongloop/loopback-connector/pull/34.

Being set to 'includeHasMany', findCaller option triggers injection of
PARTITION BY clause in buildColumnNames() in
loopback-connector-mssql/lib/mssql.js only when find() function is
called to process include filter with 'has many' relation.
This commit is contained in:
eugene-frb 2015-11-19 11:10:52 -08:00
parent 84e606bc59
commit 96020c7e7e
1 changed files with 1 additions and 0 deletions

View File

@ -507,6 +507,7 @@ Inclusion.include = function (objects, include, options, cb) {
inq: uniq(sourceIds)
};
relation.applyScope(null, filter);
options.findCaller = 'includeHasMany';
relation.modelTo.find(filter, options, targetFetchHandler);
/**
* Process fetched related objects