|
@@ -82,14 +82,17 @@ proto.isSimple = function isSimple(){
|
|
|
return true;
|
|
return true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-proto.addDependencies = function addDependencies(deps, path){
|
|
|
|
|
|
|
+proto.addDependencies = function addDependencies(depsTracker, path){
|
|
|
|
|
+ if (typeof depsTracker.fields == 'undefined'){
|
|
|
|
|
+ depsTracker.fields = {};
|
|
|
|
|
+ }
|
|
|
var pathStr = "";
|
|
var pathStr = "";
|
|
|
if (path instanceof Array) {
|
|
if (path instanceof Array) {
|
|
|
if (path.length === 0) {
|
|
if (path.length === 0) {
|
|
|
// we are in the top level of a projection so _id is implicit
|
|
// we are in the top level of a projection so _id is implicit
|
|
|
if (!this.excludeId) {
|
|
if (!this.excludeId) {
|
|
|
- deps[Document.ID_PROPERTY_NAME] = 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ depsTracker.fields[Document.ID_PROPERTY_NAME] = 1;
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
pathStr = new FieldPath(path).getPath() + ".";
|
|
pathStr = new FieldPath(path).getPath() + ".";
|
|
|
}
|
|
}
|
|
@@ -100,15 +103,15 @@ proto.addDependencies = function addDependencies(deps, path){
|
|
|
var expr = this._expressions[key];
|
|
var expr = this._expressions[key];
|
|
|
if (expr !== undefined && expr !== null) {
|
|
if (expr !== undefined && expr !== null) {
|
|
|
if (path instanceof Array) path.push(key);
|
|
if (path instanceof Array) path.push(key);
|
|
|
- expr.addDependencies(deps, path);
|
|
|
|
|
|
|
+ expr.addDependencies(depsTracker, path);
|
|
|
if (path instanceof Array) path.pop();
|
|
if (path instanceof Array) path.pop();
|
|
|
} else { // inclusion
|
|
} else { // inclusion
|
|
|
if (path === undefined || path === null) throw new Error("inclusion not supported in objects nested in $expressions; uassert code 16407");
|
|
if (path === undefined || path === null) throw new Error("inclusion not supported in objects nested in $expressions; uassert code 16407");
|
|
|
- deps[pathStr + key] = 1;
|
|
|
|
|
|
|
+ depsTracker.fields[pathStr + key] = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return deps; // NOTE: added to munge as a convenience
|
|
|
|
|
|
|
+ return depsTracker; // NOTE: added to munge as a convenience
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|