Hey guys,
I’m trying to connect 2 users which are located in the same area (depends on their given radius). This is how my query looks like:
const user = Meteor.users.findOne({_id: this.userId});
const findObject = {
'_id': {$nin: [this.userId]},
'status.online': true,
'profile.location': {$near:{$geometry:{type:'Point',coordinates:[user.profile.location.coordinates[0],user.profile.location.coordinates[1]]},$maxDistance:user.profile.radius}}
};
This works fine without problems. Now I want to verify that User A is also in the range of User B (if he has a different radius given). I’m also using findAndModify
to prevent race conditions. Any idea how I could solve this in one query?