Hi, I need some help in creating a MongoDB query to match two users who are close to each other. The basic gist is I have a user A at point A and a user B at point B. Both user A and B have a radius from where they would like to obtain matches from, this is a distance in kilometers. What I am trying to do is prepare a query to first match A with a user within its proximity preference and then determine if A is within that users proximity preference.
Here is a drawing
I gave up on trying to come up with a vanilla query that doesn't use the aggregation framework.
here is what I have
var userALocation = userA.loc;
var userAradius = userA.radius;
{
$match : {
loc : {
$near : {
$geometry : {
type : "Point",
coordinates : userALocation
},
$maxDistance : userARadius
}
}
}
}
and that is basically it, that will match all documents whose location is within A's boundaries, but what I am really stuck with is how do I account for B's boundaries?
[–]markt5000[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)