forms-angular 0.12.0-beta.249 → 0.12.0-beta.250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/data_form.js +10 -2
- package/package.json +1 -1
package/dist/server/data_form.js
CHANGED
|
@@ -989,6 +989,7 @@ class FormsAngular {
|
|
|
989
989
|
}
|
|
990
990
|
// Now we need to make sure that we restrict the lookup to documents we have access to
|
|
991
991
|
if (resource.options.findFunc) {
|
|
992
|
+
let allowNulls = false;
|
|
992
993
|
// If the next stage is an $unwind
|
|
993
994
|
let nextStageIsUnwind = false;
|
|
994
995
|
if (array.length >= pipelineSection) {
|
|
@@ -1003,6 +1004,9 @@ class FormsAngular {
|
|
|
1003
1004
|
}
|
|
1004
1005
|
if (nextStage["$unwind"] && nextStage["$unwind"].path === "$" + lookupField) {
|
|
1005
1006
|
nextStageIsUnwind = true;
|
|
1007
|
+
if (nextStage["$unwind"].preserveNullAndEmptyArrays) {
|
|
1008
|
+
allowNulls = true;
|
|
1009
|
+
}
|
|
1006
1010
|
}
|
|
1007
1011
|
}
|
|
1008
1012
|
}
|
|
@@ -1010,8 +1014,8 @@ class FormsAngular {
|
|
|
1010
1014
|
throw new Error('No support for $lookup where the next stage is not an $unwind and the resources has a findFunc');
|
|
1011
1015
|
}
|
|
1012
1016
|
// Push the $unwind, add our own findFunc, and increment the pipelineStage counter
|
|
1013
|
-
retVal.push(
|
|
1014
|
-
|
|
1017
|
+
retVal.push(array[pipelineSection + 1]);
|
|
1018
|
+
let lookedUpFindQry = await this.doFindFuncPromise(req, resource);
|
|
1015
1019
|
// Now we need to put the lookup base into the criteria
|
|
1016
1020
|
for (const prop in lookedUpFindQry) {
|
|
1017
1021
|
if (lookedUpFindQry.hasOwnProperty(prop)) {
|
|
@@ -1019,7 +1023,11 @@ class FormsAngular {
|
|
|
1019
1023
|
delete lookedUpFindQry[prop];
|
|
1020
1024
|
}
|
|
1021
1025
|
}
|
|
1026
|
+
if (allowNulls) {
|
|
1027
|
+
lookedUpFindQry = { $or: [lookedUpFindQry, { [lookupField]: { $exists: false } }] };
|
|
1028
|
+
}
|
|
1022
1029
|
retVal.push({ $match: lookedUpFindQry });
|
|
1030
|
+
pipelineSection++;
|
|
1023
1031
|
}
|
|
1024
1032
|
}
|
|
1025
1033
|
break;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mark Chapman <support@forms-angular.org>",
|
|
4
4
|
"description": "A form builder that sits on top of Angular.js, Twitter Bootstrap, jQuery UI, Angular-UI, Express and Mongoose. Opinionated or what?",
|
|
5
5
|
"homepage": "http://forms-angular.org",
|
|
6
|
-
"version": "0.12.0-beta.
|
|
6
|
+
"version": "0.12.0-beta.250",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=8.x",
|
|
9
9
|
"npm": ">=5.x"
|