summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/aggregation_cursor_invalidations.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/aggregation_cursor_invalidations.js')
-rw-r--r--jstests/noPassthrough/aggregation_cursor_invalidations.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/jstests/noPassthrough/aggregation_cursor_invalidations.js b/jstests/noPassthrough/aggregation_cursor_invalidations.js
index 07155ff7135..a610e8e5441 100644
--- a/jstests/noPassthrough/aggregation_cursor_invalidations.js
+++ b/jstests/noPassthrough/aggregation_cursor_invalidations.js
@@ -99,10 +99,13 @@ assertNoOpenCursorsOnSourceCollection();
// Test that dropping the source collection between an aggregate and a getMore will *not* cause
// an aggregation pipeline to fail during the getMore if it *does not need* to fetch more
// results from the collection.
+//
+// The test expects that the $sort will execute in the agg layer, and will not be pushed down into
+// the PlanStage layer. We add an $_internalInhibitOptimization stage to enforce this.
setup();
res = assert.commandWorked(testDB.runCommand({
aggregate: sourceCollection.getName(),
- pipeline: [{$sort: {x: 1}}],
+ pipeline: [{$_internalInhibitOptimization: {}}, {$sort: {x: 1}}],
cursor: {
batchSize: batchSize,
},