diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 7a6d55420..b9f153751 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -471,7 +471,7 @@ $this->options['writeConcern'] - $cmd['writeConcern'] + $cmd['comment'] $deleteOptions['hint'] $options['comment'] $options['session'] diff --git a/src/Operation/Aggregate.php b/src/Operation/Aggregate.php index 357b38ec5..4d6c5867c 100644 --- a/src/Operation/Aggregate.php +++ b/src/Operation/Aggregate.php @@ -300,9 +300,6 @@ public function getCommandDocument() { $cmd = $this->createCommandDocument(); - // The 'explain' option is incompatible with the explain command - unset($cmd['explain']); - // Read concern can change the query plan if (isset($this->options['readConcern'])) { $cmd['readConcern'] = $this->options['readConcern']; diff --git a/src/Operation/Find.php b/src/Operation/Find.php index e88df3146..8725d37e8 100644 --- a/src/Operation/Find.php +++ b/src/Operation/Find.php @@ -338,11 +338,6 @@ public function getCommandDocument() return $cmd; } - // Read concern can change the query plan - if (isset($this->options['readConcern'])) { - $cmd['readConcern'] = $this->options['readConcern']; - } - // maxAwaitTimeMS is a Query level option so should not be considered here unset($options['maxAwaitTimeMS']); diff --git a/tests/Operation/AggregateTest.php b/tests/Operation/AggregateTest.php index 1c8af61fe..f72fc5a22 100644 --- a/tests/Operation/AggregateTest.php +++ b/tests/Operation/AggregateTest.php @@ -122,7 +122,7 @@ public function testExplainableCommandDocument(): void 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'useCursor' => true, // Intentionally omitted options - 'explain' => true, + // The "explain" option is illegal 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array', 'document' => 'array'], 'writeConcern' => new WriteConcern(0), @@ -140,6 +140,7 @@ public function testExplainableCommandDocument(): void 'maxTimeMS' => 100, 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'let' => (object) ['a' => 1], + 'cursor' => ['batchSize' => 100], ]; $this->assertEquals($expected, $operation->getCommandDocument()); }