MongoDB in Discord.js - Trouble accessing database

I’m struggling with this code. The Database connectivity test works, and it connects to the database. However once that code is finished it closes the connection and the data becomes non-accessible. When I copy and paste the same code from the connectivity test to access the database every time I receive a command then it works, HOWEVER it makes the execution time of the very slow compared to usual. Is there a workaround to this issue so I wouldn’t have to open the database every time I receive a new command?