Skip to content

Commit bafe066

Browse files
feat: Implement Java update operations
1 parent 3ede9b0 commit bafe066

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/40-CRUD/5-UPDATE.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ Executing the above command will insert a fresh new document in the collection,
118118
Console.WriteLine($"Matched: {result.MatchedCount}, Modified: {result.ModifiedCount}");
119119
```
120120
</div>
121+
</TabItem><TabItem value="Java" label="Java">
122+
<div>
123+
```Java
124+
import static com.mongodb.client.model.Filters.eq;
125+
126+
var query = eq("title", "Treasure of the Sun");
127+
var update = Updates.set("pages", 449);
128+
UpdateResult updateResult = books.updateOne(query, update);
129+
System.out.println("Modified document count: " + updateResult.getModifiedCount());
130+
```
131+
</div>
121132
</TabItem>
122133
</Tabs>
123134
</details>

0 commit comments

Comments
 (0)