Skip to content

Commit

Permalink
Let the server throw errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jun 19, 2023
1 parent fac470b commit 8513129
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@
<code>$this-&gt;options['writeConcern']</code>
</MixedArgument>
<MixedAssignment occurrences="5">
<code>$cmd['writeConcern']</code>
<code>$cmd['comment']</code>
<code>$deleteOptions['hint']</code>
<code>$options['comment']</code>
<code>$options['session']</code>
Expand Down
3 changes: 0 additions & 3 deletions src/Operation/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
5 changes: 0 additions & 5 deletions src/Operation/Find.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down
3 changes: 2 additions & 1 deletion tests/Operation/AggregateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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());
}
Expand Down

0 comments on commit 8513129

Please sign in to comment.