Increase in connections on updating mongodb npm to version 5.9.2

Node version: 16+. On updating mongodb npm version to 5.9.2 in loopback 3 app, we experienced rapid increase in number of connections which dont close. Although in mongodb version 3.0.0, we are not experiencing this issue.
Can some one suggest solution

Starting with Node driver v4.0 the only topology representation was the unifiedTopology (see changelog). See here for 3.x docs that call out the differences between the legacy and unified topologies (including behavioural changes and deprecated events and options).

TL;DR though, a driver that supports MongoDB 4.4+ will open more connections to the cluster than older drivers. I documented this in a bit more detail at How Many Connections is My Application Establishing to My MongoDB Cluster? | ALEX BEVILACQUA.

2 Likes