[Serverless] Connection 27017 closed

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

Hi @David_Oyedeji - Welcome to the community.

Thanks for raising this one.

I’d just like to clarify one thing here regarding the following:

The error only occurs when using atlas serverless because I’ve tried it on the community server and it works fine.

When you ran it on the community server, could you confirm what version of MongoDB was in use?

Regards,
Jason

Hi @Jason_Tran - thanks for the reply.
The MongoDB version used was 5.0.9

Best,
David

Thanks for confirming @David_Oyedeji,

I believe this may be related to SERVER-68062 noted in the 6.0 Release Notes. If you’re still receiving this error in version 6.0.1, please let me know. As per the current status of the time of this messge:

Unresolved. This issue will be fixed in a future 6.0 minor release.

Regards,
Jason