-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 3.3.9
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
ALL
-
-
Query 18 (08/05/16)
The mongo/s/commands/cluster_commands library in mongos depends on the mongo/db/pipeline/pipeline library, which doesn't include the $facet stage. Since the $facet stage depends on both the pipeline and document_source libraries, it exists as its own document_source_facet library. We should change mongos to link against the mongo/db/pipeline/aggregation library instead.
The jstests/aggregation/sources/facet/use_cases.js test runs the $facet stage against a sharded cluster through mongos, but failed to catch this issue for a couple of reasons:
- The implementation of the "aggregate" command in mongos skips parsing the pipeline when the database the command is being run on doesn't have sharding enabled.
- The test case for a $facet stage on a database with sharding enabled was expected to fail because it was designed to test that a $lookup on a sharded collection was still disallowed.