Usa un pipeline de agregación para agrupar, proyectar, ordenar y limitar:
db.col.aggregate([
{ $group: { _id: "$Appname", softcount: { $max: "$softcount" } } },
{ $project: { _id: 0, Appname: "$_id", softcount: 1 } },
{ $sort: { softcount: -1 } },
{ $limit: 5 }
])Resultado de ejemplo:
{ "softcount": 10.0, "Appname": "ktr" }
{ "softcount": 8.0, "Appname": "rsr" }
{ "softcount": 6.0, "Appname": "ssl" }
{ "softcount": 5.0, "Appname": "ppr" }
{ "softcount": 4.0, "Appname": "crs" }Más información: Aggregation Framework.