Database

[{_id:9,items:[{defindex:17,},{defindex:19,}]},{_id:87,items:[{defindex:18,},{defindex:5,}]},{_id:67,items:[{defindex:17,},{defindex:188,}]}]

Query

db.collection.aggregate([{$setWindowFields:{output:{totalCount:{$count:{}}}}},{$unwind:"$items"},{$group:{_id:"$items.defindex",count:{$sum:1},totalCount:{$first:"$totalCount"}}},{$project:{count:1,usage:{$divide:["$count","$totalCount"]}}},{$sort:{count:-1}}])

Result