File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1473,6 +1473,26 @@ export class FormsAngular {
1473
1473
// to ensure that the pipeline returns fields used by the findFunc
1474
1474
console . log ( `In some scenarios $lookups that use pipelines may not provide all the fields used by the 'findFunc' of a collection.
1475
1475
If you get no results returned this might be the explanation.` )
1476
+
1477
+ /* Sanitise the pipeline we are doing a lookup with, removing hidden fields from that collection */
1478
+ const lookupCollectionName = stage . $lookup . from ;
1479
+ const lookupResource =
1480
+ that . getResourceFromCollection ( lookupCollectionName ) ;
1481
+ let lookupHiddenLookupFields = { } ;
1482
+ if ( lookupResource ) {
1483
+ if ( lookupResource . options ?. hide ?. length > 0 ) {
1484
+ lookupHiddenLookupFields = this . generateHiddenFields (
1485
+ lookupResource ,
1486
+ false
1487
+ ) ;
1488
+ }
1489
+ }
1490
+ stage . $lookup . pipeline = await that . sanitisePipeline (
1491
+ stage . $lookup . pipeline ,
1492
+ lookupHiddenLookupFields ,
1493
+ findFuncQry ,
1494
+ req
1495
+ ) ;
1476
1496
} else {
1477
1497
throw new Error (
1478
1498
`No support for $lookup of with properties ${ lookupProps . join ( ', ' ) } `
You can’t perform that action at this time.
0 commit comments