How does Mongoose poolSize work How does Mongoose poolSize work mongoose mongoose

How does Mongoose poolSize work


How does mongoose connection pool work?

  • Most MongoDB drivers support a parameter that sets the max number of connections (pool size) available to your application. The default pool size varies from driver to driver, for Mongoose is 5. However, Mongoose might open more than poolSize connections for internal use.

Why is my poolSize doesn't get applied?

  • poolSize is the maximum number of sockets the MongoDB driver will keep open for this connection. Mongoose will automatically manage the number of connections to the MongoDB server.

Does having multiple connections mean that my queries would get process in parallel by mongo db ? or does one mongoose connections means one client connection?

  • MongoDB only allows one operation per socket at a time. So, the connection pool size can be thought of as the max number of concurrent requests that your driver can service.