Skip to content

Commit

Permalink
Extend testUpdateArrayMatch_ObjectId #232
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaldvogel committed Dec 30, 2024
1 parent 27e0deb commit 0fce63f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3490,11 +3490,15 @@ void testUpdateArrayMatch_ObjectId() {
collection.insertOne(json("_id: 1")
.append("myArray", List.of(new Document("_id", new ObjectId(123, 456)))));

collection.updateOne(
UpdateResult updateResult = collection.updateOne(
and(eq("_id", 1), eq("myArray._id", new ObjectId(123, 456))),
set("myArray.$.name", "new name")
);

assertThat(updateResult.getMatchedCount()).isEqualTo(1);
assertThat(updateResult.getModifiedCount()).isEqualTo(1);
assertThat(updateResult.getUpsertedId()).isNull();

assertThat(collection.find())
.containsExactly(json("_id: 1")
.append("myArray", List.of(
Expand Down

0 comments on commit 0fce63f

Please sign in to comment.