Let say I have the following collection:
{ _id: 1, Array: [ { K: \"A\", V: 8 }, { K: \"B\", V: 5 }, { K: \"C\", V: 13 } ] } { _id: 2, Array: [ { K:
As @JohnnyHK said:
db.col.aggregate([ {$unwind: '$Array'}, {$group: {_id: '$_id', Array: {K: {$max: '$K'}, V: {$max: '$V'}}}} ])
Something like that.