Just adjust the connection string with a relevant date, which can be gained from email for your MongoDB node:
- {user} – username to log into database with
- {password} – password for the appropriate user
- {host} – link to your MongoDB container
- {port} – port to be used for connection (use the default one – 27017)
- {database} – database to be accessed (e.g. the default admin one)

This script will connect to the specified database server and will try to get its status. If any error occurs in the process, its description will be printed; otherwise, just a “You are connected!” string will be displayed.
5. So, execute code in the file by running the appropriate command: