MongoExpiredSessionError with Flex instance

Hi there,

Our dedicated cluster for our development environments have been migrated to a Flex instance, and ever since we’ve been unable to run our test suites due to MongoExpiredSessionError’s.

I know that this can be caused by incorrectly referencing a closed DB connection, however we’ve not made any changes to how we’re managing connection references in our test suite.

Our concern is that the Flex instance’s architecture is so different from a dedicated cluster that perhaps that is the cause. And soon our production instance will be migrated to Flex, which might also migrate this problem.

We’re using a singleton throughout our application so we can reuse the database connection per session. Is this the correct approach with Flex instances?

Our production environment is also serverless, will we need to managing connection pooling?

This sudden appearance of this error has us very worried about this migration.