Too many connections using node driver with atlas

I’ve opened an issue on the mongo remix example here.

After not hearing back on the issue, I contacted support who pointed me here.

Is anyone able to confirm if I’m using the driver correctly? It’s a serious concern for me that the connections increase until a new deployment.

I can’t find a definitive answer on whether I should be storing the client in memory, like I am, storing the “db” in memory, or even storing each “collection” in memory.

In contrast to the remix example, the mongo university example stores the “collection” in memory.

Any help would be greatly appreciated. Thanks.