Database
[{_id:ObjectId("63c6a4b858612f44f37d4771"),type:"TypeA",priority:1},{_id:ObjectId("627279d3ba7aef5d6418c867"),type:"TypeB",priority:2}]
Query
db.collection.aggregate([{$project:{newDoc:[{k:"$type",v:{_id:"$_id",priority:"$priority"}}]}},{$replaceRoot:{newRoot:{$arrayToObject:"$newDoc"}}}])