I have products that are located in multiple retail locations. For each retailer, I am included their long/lat in the _geoloc of the product as an array. There may 10's or 100's of retailers per product.
If I use regular $near in my query, it seems to work but will give me the same document multiple times if more than one location in _geoloc is within max distance. I only want the single document.
Using geoNear, I don't seem to be getting any filtering at all. I just get 100 records (max returned allowed) every time.
Do you have an example for geoNear in action with say, a 3 mile radius?
Hey Daniel, We don't have a sample for that specific use case right now (we have geoloc samples but they're rather simple in their querying structure). It could be that MongoDB doesn't support that, and you'd have to use BL to de-dupe.
To help me look into this problem, can you share the specific query?
almost 7 years ago
Let me rephrase the issue...there are duplicate documents in the results. The geoNear function pre mongo2.6 uses a 'uniqueDocs' flag to specifit whether to return the same doc more than once but that doesn't appear to be working.