In my aggregation pipeline, running $lookup after $geocode causes a connection error as shown in the screenshot. The error only occurs when using atlas serverless because I’ve tried it on the community server and it works fine.
The aggregation code looks like this:
[
{
'$geoNear': {
'near': {
'type': 'Point',
'coordinates': [
-0.0000, 51.00000
]
},
'distanceField': 'string',
'maxDistance': 500,
'query': {},
'includeLocs': 'dist.location',
'spherical': true
}
}, {
'$lookup': {
'from': 'blockedusers',
'localField': 'user',
'foreignField': 'blockedUserId',
'as': 'relationship'
}
}, {
'$match': {
'relationship.userId': {
'$ne': 'eudwvdeiwuedbwiuebRandomUserId'
}
}
}
]
I’ve tried running this on compass and hosted the node js api on elastic beanstalk and still ran into the problem of connection 36 to 52.215.2.251:27017 closed