Mongo Playground

Configuration

[{"status":"ONBOARD","count":1},{"status":"PENDING","count":1},]

Query

db.collection.aggregate([{$group:{_id:{status:"$status"},count:{$sum:1}}},{$project:{_id:0,status:"$_id.status",count:1}}])

Result