Serverless Express + MongodB

Hello.

We have an Express Typescript app running that heavily relies on MongoDB.

We’re looking to migrate to serverless but would really like to keep using MongoDB if it makes sense. I saw a bunch of tutorials but they all init the mongo connection in the global scope which could be a problem as so many of our endpoints use mongo. I also haven’t seen any documentation on how to keep a connection pool open and share across lambdas.

I’m wondering if anyone solved this problem? Would really love to hear your thoughts

Eran