I am updating packages from an old project, as well as Node. I've updated from node 12 to node 18, 2 versions at a time, and production seems to be running fine, but in my development environment, I'm randomly getting this error:
MongooseServerSelectionError: connection <monitor> to 127.0.0.1:27017 closed
I found this.
All I had to do was replace my connection URL mongodb://localhost:27017/myDB
by mongodb://127.0.0.1:27017/myDB
, and it started working normally again