how to use replace root in group stage mongodb code example
Example: mongodb replace root
db.collection.aggregate([ { $replaceRoot: { newRoot: "$name" } }])
db.collection.aggregate([ { $replaceRoot: { newRoot: "$name" } }])