* [Accounts, zones, and profiles](https://developers.cloudflare.com/fundamentals/setup/accounts-and-
I got MongoDB connection pooling working by using a Durable Object!
My
index.js
looks like this. I’ve provided a locationHint
to my DO, based on where my MongoDB databases are:
Then MongoDBConnection.js
looks like this:
This code just transparently forwards all requests straight onto the DO, which can hold onto the connection pool across multiple requests and re-use it. My end-to-end timings went from ~2000ms to ~300ms after doing this!
(Also cross-posted this to the workerd discussion above)0 Replies