Watch keynotes and sessions from, our virtual developer conference.

UnhandledPromiseRejectionWarning: MongoError: Topology closed

Hey, I’m working on setting up a discord.js database (for a bot), and I’m getting this warning.

Example code for one of my commands is (I know there are some now unused variables. Just didn’t want to delete until change is complete)

I used to just store it all in a local file, but was informed that it’d be better to move it to a database. Nobody in the servers could figure out what was wrong.

Before, the bot worked and just said the warning. Now, it doesn’t work. I contacted discord.js support servers, and they said to contact you as it was an error on this end. Thank you!