Database

[{"_id":"6225ca4052e7c226e2dd836d","data":["58","42","12","19","47","32","99","57","71","81","32","97","52","32","58","92"]}]

Query

db.collection.aggregate([{$match:{}},{$unwind:"$data"},{$group:{_id:"$data",c:{$sum:1},id:{$first:"$_id"}}},{$group:{_id:"$id",data:{$push:{k:"$_id",v:"$c"}}}},{$set:{data:{$arrayToObject:"$data"}}}])

Result