Can you be more specific? What does "'fit' to both addresses" mean? Can you show us your example query, with sample documents, that tries to do what you want but isn't working?-Will
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/ede75ea6-63e2-4436-8bc3-51de0f3ae627%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If user 1 wants to find other users, user 3 and user 6 have to be shown (because only there both addresses are "near").
In my real project the data is a bit more complex and of course I have real addresses (with latitude and longitude).
If two $geoNear are not possible, I could go first for the pickup address, then for the delivery address. However I fear a bad performance here because I have millions of addresses.
Need more details? Please let me know.
db.trips.aggregate( { $match: { 'start.gps.loc': { $geoWithin: { $centerSphere: [ [ -4.364399, 36.514921 ], 0.2/6378.1 ] } }, 'stop.gps.loc': { $geoWithin: { $centerSphere: [ [ -4.456572, 36.534344 ], 0.2/6378.1 ] } } }}, { $project: { Aloc: '$start.gps.loc.coordinates', Bloc:'$stop.gps.loc.coordinates', Atag:'$start.addr.tag', Btag:'$stop.addr.tag', }})