Skip to content

Commit 36223ef

Browse files
authored
Ensure ExplainFunctionalTest does not optimise pipeline on MongoDB 6.3 (#1008)
1 parent bf91db2 commit 36223ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/Operation/ExplainFunctionalTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ public function testAggregate(): void
365365

366366
$this->createFixtures(3);
367367

368-
$pipeline = [['$group' => ['_id' => null]]];
368+
// Use a $sort stage to ensure the aggregate does not get optimised to a query
369+
$pipeline = [['$group' => ['_id' => null]], ['$sort' => ['_id' => 1]]];
369370
$operation = new Aggregate($this->getDatabaseName(), $this->getCollectionName(), $pipeline);
370371

371372
$explainOperation = new Explain($this->getDatabaseName(), $operation, ['verbosity' => Explain::VERBOSITY_QUERY, 'typeMap' => ['root' => 'array', 'document' => 'array']]);

0 commit comments

Comments
 (0)