I'm fairly new to Node + Mongo, and I'm trying to see if there's a way I can back up my database every time I make a new commit. Is this possible? I know how to backup using mongodump, but I would prefer to avoid having to do this each time I push to the server. If the data directory idea doesn't work, would it be possible to write a script which backs up to my node server repository and then does the push every time I run it?
I haven't been able to find anything relating git and mongo online, so I think I may be looking at this wrong/don't understand something. Any help would be greatly appreciated! Thanks!
All you need is MMS(Mongo monitoring service). It is a cloud based continuous backup service(plus lot of automation like on-demand restore,monitoring) offered by MongoDB. With MMS every single time you make a commit the DB gets backed up incrementally. It also possible to easily deploy and monitor standalone,replica-set or a sharded setup.
MMS is better compared to mongodump as it tends to do an incremental backup vs whole database backup.Writing a script which does mongodump on every commit will work but you will have to delete the old backup file every time you want to backup for a new commit. MMS cuts down on this devops overhead by manging all of this boiler-plate effort(writing scripts like mentioned) that goes into DBA's role.
Check-out this link for more info: MMS