From a92850032c7d6d824f2b8088ff603de51863bbf1 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 17 May 2019 10:28:06 -0400 Subject: [PATCH] PHPLIB-431: Relax aggregate explain test for 4.2 servers --- tests/Operation/AggregateFunctionalTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Operation/AggregateFunctionalTest.php b/tests/Operation/AggregateFunctionalTest.php index eadd5e12f..56565939e 100644 --- a/tests/Operation/AggregateFunctionalTest.php +++ b/tests/Operation/AggregateFunctionalTest.php @@ -190,7 +190,13 @@ public function testExplainOption() $results = iterator_to_array($operation->execute($this->getPrimaryServer())); $this->assertCount(1, $results); - $this->assertArrayHasKey('stages', $results[0]); + + /* MongoDB 4.2 may optimize aggregate pipelines into queries, which can + * result in different explain output (see: SERVER-24860) */ + $this->assertThat($results[0], $this->logicalOr( + $this->arrayHasKey('stages'), + $this->arrayHasKey('queryPlanner') + )); } public function testExplainOptionWithWriteConcern()