Backup MongoDB as text, not binary for version control

Can this be done?

The reason I ask is because it would be useful to back up as a hook with a pre-commit and include in this text backup somehow with the code to be committed, so that each revision in version control (git) has the necessary backups associated with it.

I understand that it may be possible to get MongoDB to spit out all its collections as JSON and maintain them that way, but then it will not contain DB metadata and collections.

The main problem is that when branching, to make changes to the code on the server side, and then returning this branch, it is easy for us to forget to make the necessary backups that will allow us to return efficiently (the code will no longer correspond to the scheme). It could be argued that this was a programmer's mistake, but I think that there should be some kind of automation to ensure that we have a database version that is relevant for each version of the code. This is a problem with circuits that are amorphous in the early days of the project ... dynamic circuits are the main Mong and Mongo's scourge.

+4
source share
1 answer

MongoDB BSON ( JSON), , , . MongoDB, mongodump. git .

. , , .

- , - . , / , , , .

:

+2

All Articles