0
我正在將OSM文件轉換爲JSON。在此查詢中,我試圖獲取.json文件中所有設施的計數。我需要知道如何獲得輸出反向。如何調整MongoDB查詢以降序獲得輸出
查詢: -
db.char.aggregate([{"$match":{"amenity":{"$exists":1}}}, {"$group":{"_id":"$amenity",
"count":{"$sum":1}}}, {"$sort":{"count":1}}, {"$limit":100}])
電流輸出: -
{ "_id" : "bar", "count" : 1 }
{ "_id" : "fitness_center", "count" : 1 }
{ "_id" : "fountain", "count" : 1 }
{ "_id" : "studio", "count" : 1 }
{ "_id" : "telephone", "count" : 1 }
{ "_id" : "nightclub", "count" : 1 }
{ "_id" : "shelter", "count" : 1 }
{ "_id" : "courthouse", "count" : 1 }
{ "_id" : "kindergarten", "count" : 1 }
{ "_id" : "doctors", "count" : 1 }
{ "_id" : "laboratory", "count" : 1 }
{ "_id" : "toilets", "count" : 2 }
{ "_id" : "community_centre", "count" : 2 }
{ "_id" : "embassy", "count" : 2 }
{ "_id" : "fire_station", "count" : 2 }
{ "_id" : "townhall", "count" : 2 }
{ "_id" : "prison", "count" : 2 }
{ "_id" : "clinic", "count" : 2 }
{ "_id" : "pub", "count" : 3 }
{ "_id" : "grave_yard", "count" : 3 }
Thanks.its working。 – satyaki