Is it possible to query a collection in MongoDB and return the results grouped by geometric boundaries? For instance, I have one collection of addresses, each of which has a lat/long defined as a GeoJSON Point. I also have a collection of city council wards, each of which has a GeoJSON MultiPolygon object defining its boundaries. Is there a way to query the wards
collection such that my results are populated with a field that shows the total number of addresses in each ward?
Conversely, is it possible to query the addresses
collection and get my results populated with the ward that each address lies within?
I have read up on geoSpatial operators, the aggregation framework, and mapReduce functionality, but I just can't quite see how they would all go together in this particular instance.
Thanks!