I have backed up the data from my deployed database successfully using the following commands:
mongodump admin -u user -p password
Is there a shell script to do this automatically with the password hidden(to protect the password even someone get the script)?
You can use crontab to create scheduled task on the server that will run this command for you. in that way only those who have access to the server can get your password.
Here is a link how to do it https://sheharyar.me/blog/regular-mongo-backups-using-cron/