[JAVA-2727] Create Array update code samples for MongoDB 3.6 page Created: 05/Jan/18  Updated: 09/Jan/18  Resolved: 09/Jan/18

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Rathi Gnanasekaran Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DRIVERS-434 Provide code samples for MongoDB 3.6 ... Closed

 Description   

Array Updates

// 3. Exploiting the power of arrays
MongoCollection<Document> collection = client
  .getDatabase("test")
  .getCollection("arrayUpdatesTest");
 
collection.updateOne(
  Filters.eq("_id", 1),
  Updates.set("a.$[i].b", 2),
 
new UpdateOptions()
  .arrayFilters(
    Collections.singletonList(
      Filters.eq("i.b", 0))));



 Comments   
Comment by Ross Lawley [ 09/Jan/18 ]

Nothing to do for Java! The example sample code is Java.

Generated at Thu Feb 08 08:57:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.