{
"_id" : 1,
"Grades" : [
{" grade ", 80, "mean" : 75, "STD" : 6},
{" grade ", 85, "mean" : 90, "STD" : 4},
{" grade ", 85, "mean" : 85, "STD" : 6}
]
}
{
"_id" : 2,
"Grades" : [
{" grade ", 90, "mean" : 75, "STD" : 6},
{" grade ", 87, "mean" : 90, "STD" : 3},
{" grade ", 85, "mean" : 85, "STD" : 4}
]
}
Db. Students2. Update (
{},
{$set: {" grades. $[r]. Elem scheme ": 100}},
{
Multi: true,
ArrayFilters: [{" elem. Grade ": {$gte: 85}}]
}
)
The arrayFilters here how to write in the Java API
Internet is the most close to the writing of
Since elementInstanceBOs is array structure, want to update the specific which one, can be expressed in $array subscript,
Query Query=new Query (Criteria. The where (" elementInstanceBOs. Slug "), is (pSlug));
Update the Update=new Update (). The set (" elementInstanceBOs $. Status, "pElementInstanceStatusEnum)
Set (" elementInstanceBOs $. RunningCellNum runningCell);
MongoTemplate. UpdateFirst (query, update, ApplicationInstanceBO. Class);