Skip to content

Commit acc21d4

Browse files
committed
Skip pipeline in update operations for server version < 4.0
1 parent 5949533 commit acc21d4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Collection.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -1133,9 +1133,7 @@ public function withOptions(array $options = [])
11331133

11341134
private function inheritBuilderEncoder(array $options): array
11351135
{
1136-
$options['builderEncoder'] = $this->builderEncoder;
1137-
1138-
return $options;
1136+
return ['builderEncoder' => $this->builderEncoder] + $options;
11391137
}
11401138

11411139
private function inheritCodec(array $options): array

tests/Collection/BuilderCollectionFunctionalTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ public function testUpdateOne(): void
209209

210210
public function testUpdateWithPipeline(): void
211211
{
212+
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
213+
212214
$result = $this->collection->updateOne(
213215
Query::query(x: Query::lt(2)),
214216
new Pipeline(
@@ -235,6 +237,8 @@ public function testUpdateMany(): void
235237

236238
public function testUpdateManyWithPipeline(): void
237239
{
240+
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
241+
238242
$result = $this->collection->updateMany(
239243
Query::query(x: Query::gt(1)),
240244
new Pipeline(

0 commit comments

Comments
 (0)