Mongodb in production

Asked

Viewed 310 times

6

I have an application that uses Mongodb, I’m already coming to the end of its development and I just started thinking about how would be made the installation of this bank in production environment. During development the Collections were being created as needed, but I never really stopped to think about how I was going to restore it in production.

How is this usually done? Should I create only the Collections empty start and let the application run? Or I should use the mongodump? If the mongodump is the recommended way, as I do so that it does not backup the Documents and contains only Collections with their right?

From now on, thank you.

1 answer

1


This depends on what is stored in each Core. I usually identify the ones that represent user-created data versus the data that is needed for the application to run (type country and state lists). The latter I call mandatory data and create scripts to create and populate these Collections (or even tables when using relational DB.)

You can also use mongodump to copy this required data but I think it is important to have the script and an origin of this data that is not your development database. Imagine if you depend on this bank to create the production bank and give an unlucky to corrupt the bank before you can copy.

User data usually makes no sense to be copied for production.

mongodump will also be useful when you are setting up your production database backups (which I hope is something you plan to do as well).

  • I get it, I’m gonna do just what you said, put together a script for the creation of Collections and their respective indexes. Thank you for the reply from sergiopereira.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.