Skip to content

Commit 1c62804

Browse files
committed
Fix update
1 parent 02d1b4c commit 1c62804

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Database/Adapter/Mongo.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ public function getDocument(Document $collection, string $id, array $queries = [
11191119
}
11201120

11211121

1122-
$options = [];
1122+
$options = $this->getTransactionOptions();
11231123

11241124
$selections = $this->getAttributeSelections($queries);
11251125

@@ -1421,7 +1421,10 @@ public function updateDocument(Document $collection, string $id, Document $docum
14211421
unset($record['_id']); // Don't update _id
14221422

14231423
$options = $this->getTransactionOptions();
1424-
$this->client->update($name, $filters, $record, $options);
1424+
$updateQuery = [
1425+
'$set' => $record,
1426+
];
1427+
$this->client->update($name, $filters, $updateQuery, $options);
14251428
} catch (MongoException $e) {
14261429
throw $this->processException($e);
14271430
}

tests/e2e/Adapter/Scopes/IndexTests.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,7 @@ public function testIndexValidation(): void
268268
);
269269

270270
$this->assertFalse($validator->isValid($newIndex));
271-
272-
if ($database->getAdapter()->getSupportForAttributes()) {
273-
$this->assertEquals('Attribute "integer" cannot be part of a fulltext index, must be of type string', $validator->getDescription());
274-
} elseif (!$database->getAdapter()->getSupportForMultipleFulltextIndexes()) {
275-
$this->assertEquals('There is already a fulltext index in the collection', $validator->getDescription());
276-
}
271+
$this->assertEquals('There is already a fulltext index in the collection', $validator->getDescription());
277272

278273
try {
279274
$database->createCollection($collection->getId(), $attributes, $indexes);

0 commit comments

Comments
 (0)