Skip to content

Commit 8513129

Browse files
committed
Let the server throw errors
1 parent fac470b commit 8513129

File tree

4 files changed

+3
-10
lines changed

4 files changed

+3
-10
lines changed

psalm-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@
471471
<code>$this-&gt;options['writeConcern']</code>
472472
</MixedArgument>
473473
<MixedAssignment occurrences="5">
474-
<code>$cmd['writeConcern']</code>
474+
<code>$cmd['comment']</code>
475475
<code>$deleteOptions['hint']</code>
476476
<code>$options['comment']</code>
477477
<code>$options['session']</code>

src/Operation/Aggregate.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,6 @@ public function getCommandDocument()
300300
{
301301
$cmd = $this->createCommandDocument();
302302

303-
// The 'explain' option is incompatible with the explain command
304-
unset($cmd['explain']);
305-
306303
// Read concern can change the query plan
307304
if (isset($this->options['readConcern'])) {
308305
$cmd['readConcern'] = $this->options['readConcern'];

src/Operation/Find.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,6 @@ public function getCommandDocument()
338338
return $cmd;
339339
}
340340

341-
// Read concern can change the query plan
342-
if (isset($this->options['readConcern'])) {
343-
$cmd['readConcern'] = $this->options['readConcern'];
344-
}
345-
346341
// maxAwaitTimeMS is a Query level option so should not be considered here
347342
unset($options['maxAwaitTimeMS']);
348343

tests/Operation/AggregateTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function testExplainableCommandDocument(): void
122122
'readConcern' => new ReadConcern(ReadConcern::LOCAL),
123123
'useCursor' => true,
124124
// Intentionally omitted options
125-
'explain' => true,
125+
// The "explain" option is illegal
126126
'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED),
127127
'typeMap' => ['root' => 'array', 'document' => 'array'],
128128
'writeConcern' => new WriteConcern(0),
@@ -140,6 +140,7 @@ public function testExplainableCommandDocument(): void
140140
'maxTimeMS' => 100,
141141
'readConcern' => new ReadConcern(ReadConcern::LOCAL),
142142
'let' => (object) ['a' => 1],
143+
'cursor' => ['batchSize' => 100],
143144
];
144145
$this->assertEquals($expected, $operation->getCommandDocument());
145146
}

0 commit comments

Comments
 (0)