Answer the question
In order to leave comments, you need to log in
Mongodb. How to leave the element with the maximum value in the array?
{
"_id": 1,
"values":[
{
"value1":10,
"value2":12,
"value3":30
},
{
"value1":20,
"value2":12,
"value3":100
},
{
"value1":30,
"value2":14,
"value3":50
}
]
}
{
"_id": 2,
"values":[
{
"value1":10,
"value2":12,
"value3":60
},
{
"value1":20,
"value2":12,
"value3":80
},
{
"value1":30,
"value2":14,
"value3":70
}
]
}
values.value1 = 20
values.value2 = 12
values.value3 максимальное значение из всех значений values.value3 во всех документах
{
"_id": 1,
"values":[
{
"value1":20,
"value2":12,
"value3":100
}
]
}
{
"_id": 1,
"values":[
{
"value1":20,
"value2":12,
"value3":100
},
{
elements...
}
]
}
{
"_id": 2,
"values":[
{
elements...
}
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question