I'm having a problem querying a dataset called Geolytix Supermarkets January 2015 update The problem is that the queries I've run either return all results or no results at all. This is a snapshot of the dataset:
{"type":"FeatureCollection","features":
[{"type":"Feature","properties":{"OBJECTID":10001,"GLUID":1010010014,"Retailer":"The Co-operative Group",
"Fascia":"The Co-operative Food","StoreName":"New Road","Add1":"650 Oldham Road",
"Add2":"Failsworth", "Town":"Manchester","Locality":"Failsworth","Postcode":"M359DU",
"LongWGS84":-2.14949,"LatWGS84":53.515,"EastingBNG":390185,"NorthingBNG":402050,"PQIflag":2},"geometry":
{"type":"Point","coordinates":[-2.1494900003123174,53.51499999980253]}},
{"type":"Feature","properties":{"OBJECTID":10002,"GLUID":1010010015,"Retailer":"The Co-operative Group",
"Fascia":"The Co-operative Food","StoreName":"Mobberley","Add1":"85 Town Lane",
"Add2":null,"Town":"Mobberley","Locality":null,"Postcode":"WA167HH","LongWGS84":-2.32905,"LatWGS84":53.3136,
"EastingBNG":378175,"NorthingBNG":379680,"PQIflag":2},"geometry":
{"type":"Point","coordinates":[-2.329049999711877,53.31359999998222]}},
I understand that this data structure is embedded/nested documents within arrays and in order to retrieve the data I have to reach into the arrays and documents. To do that I attempted these queries using the dot notation:
db.January_2015.find ({"features.properties.Retailer":"The Co-operative Group"});
This one returns the entire dataset so clearly this is not the correct to reach into it. Then I tried these:
db.January_2015.find ({"features.properties: {"OBJECTID":10001}});
db.January_2015.find ({"features.properties: {"Retailer":"The Co-operative Group}});
db.January_2015.find ({"features.properties": {$elemMatch: {"OBJECTID":10001, "GLUID": 1010010014}}});
These three returned nothing at all. I have studied the documentation and according to it at least one of these approaches should have worked. What am I doing wrong here? I thought about using the aggregation framework but that seemed unduly complex for simple queries such as this. Can someone confirm whether I've tried the correct approach or if I have to use aggregation?