私はMongoDBの中にネストされた集計で国、州、郡と市の総人口を見つけるために探して、次のコレクションMongoDBの集計
{ "data" :[
{ "country" :"USA", "state": "NJ", "County" : "Middlesex", "city" : "Edison", "population" :0923422 },
{ "country" :"USA", "state": "NJ", "County" : "Mercer", "city" : "Princeton", "population" :0923422 },
{ "country" :"USA", "state": "NY", "County" : "Middlesex", "city" : "Edison", "population" :234234 },
{ "country" :"USA", "state": "NY", "County" : "Ocean", "city" : "Albony", "population" :234324 },
{ "country" :"USA", "state": "PA", "County" : "Central", "city" : "Edison", "population" :0923422 },
{ "country" :"USA", "state": "NJ", "County" : "Middlesex", "city" : "Edison", "population" :23432 },
{ "country" :"USA", "state": "OH", "County" : "Middlesex", "city" : "Cincinatti", "population" :0923422 },
{ "country" :"USA", "state": "OH", "County" : "Middlesex", "city" : "Columbos", "population" :23432 } ]
}
を持っています。
質問にお役立てください。
本当に挑戦的なもの。異なるフォーマットでは生産できません。 – notionquest