Mongo Playground

Configuration

[{id:"1",screen_size:"50",screen_resulation:"4K"},{id:"2",screen_size:"55",screen_resulation:"UHD"},{id:"3",screen_size:"55",screen_resulation:"4K"}]

Query

db.collection.aggregate([{"$facet":{"screen_size_count":[{"$group":{"_id":"$screen_size","count":{$sum:1}}}],"screen_resulation_count:":[{"$group":{"_id":"$screen_resulation","count":{$sum:1}}}]}}])

Result