I have 2 collections - one for user and other for blog. User has a location field and Blog has location and publishRadius
fields. The publishRadius
field is manually set for each blog by their authors to allow readers only from that circle to access the blog.
For each user, I want to find a list of blogs which can be served in the user’s location - kind of a reverse lookup.
I am very new to MongoDB but all the examples I have found so far are passing a static value in the maxDistance
parameter of geospatial queries. Since the radius value is specific to each Blog document, I don’t have a number to pass upfront. Have I messed up the database design, or is there a solution to this?