incomplete results by mongoDB aggregation query -
i have mongo collection sample structure
{ "_id" : objectid("57835fd76898868d7d110228"), "name" : "family vision clinic - doctors of optometry", "website" : "familyvisionclinic.ca", "phone" : null, "address" : { "street" : "650 portland st", "city" : "dartmouth", "state" : "nova scotia", "zip" : "b2w6a", "country" : "canada" }, "profile_url" : "https://www.haha.org", }
i want group entries country
here's have tried
db.subset.aggregate([{ "$unwind": "$address" }, { "$group":{"_id": "$address.country","count":{"$sum":1}}}])
but giving me incomplete results. mean many entries have united states country can see through eyeballing data while after running query no entry united states country
usa entry
{ "_id" : objectid("57835fd76898868d7d110226"), "name" : "doctors of optometry", "website" : "eyedoctorandglasses.com", "phone" : null, "address" : { "street" : "4505 sepulveda blvd", "city" : "torrance", "state" : "ca", "zip" : "90505", "country" : "united states" }, "profile_url" : "https://www.haha2.org", "id" : "3330542" }
Comments
Post a Comment