I have a document as shown below in Mongodb:
Now, I want to go to a document based on specific \"_id
\" and for that document, want to go to \"schedu
If there is no "updateOption" in spring-data, then we can use plain driver jar. I hope it will solve your problem.
MongoDatabase db = client.getDatabase("test");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z');
format.setTimeZone("EST");
List dateList = Arrays.asList(new Date[]
{format.parse("2018-07-10T00:30:00.000Z")}
);
db.getCollection("test").updateMany(new Document("_id", "x1"),
new Documen("$set", new Document("schedule.$[elem].status", "booked")),
new UpdateOptions().arrayFilters(Arrays.asList(new Document[]
{new Document("elem.Date", new Document("$in", dateList))}
)));