When you use externally hosted MongoDB, you must manage the backups by yourself, and the following guide explains how to configure the Backups.
Create a Backup
Mongodump is the utility for creating backups fir externally hosted database
mongodump --host=mongodb1.example.net --port=37017 --username=user --authenticationDatabase=admin --out=/opt/backup/mongodump-2023-05-05
–db=kendis
Note: You must schedule a script or similar setup to take the backups on daily/regular basis.
Archive Option
Archive is a backup in a single file rather than a folder.
For making an archive as an output, use the following command
mongodump --host=mongodb1.example.net --port=37017 --username=user --authenticationDatabase=admin --archive=/opt/backup/mongodump-2023-05-05.archive –db=kendis
Restore from backup
mongorestore --uri="mongodb://user@mongodb1.example.net:27017/?authSource=admin" /opt/backup/mongodump-xxxxxxxxxx
Restoring from archive dump
mongorestore --uri="mongodb://user@mongodb1.example.net:27017/?authSource=admin" --archive=/opt/backup/mongodump-xxxxxxxxxx.archive
Important Note:
Above are example commands for your reference, exact commands may vary depending on your MongoDB database version.
For further reference