Database
[{"history":{"c":2,"a":1,"b":2}}]
Query
db.collection.aggregate([{$project:{history:{$objectToArray:"$history"}}},{$unwind:"$history"},{$sort:{"history.k":1}},{$group:{_id:"$_id",history:{$push:"$history"}}},{$project:{history:{$arrayToObject:{$slice:["$history",1]}}}}])