Database
[{name:"a",otherField:1,_id:"id1"},{name:"a",otherField:2,_id:"id2"},{name:"a",otherField:3,_id:"id3"},{name:"b",otherField:1,_id:"id4"},{name:"b",otherField:2,_id:"id5"}]
Query
db.collection.aggregate([{$group:{_id:"$name",data:{$push:"$$ROOT"},maxOtherField:{$max:"$otherField"}}},{$addFields:{data:{$filter:{input:"$data",cond:{$ne:["$$this.otherField","$maxOtherField"]}}}}},{$unwind:"$data"},{$replaceRoot:{newRoot:"$data"}}])