Our team have hard time. Situation:

  1. API went down, all infrastructure (API + MongoDB) terminated.
  2. We restore API and mongodb (data restored from backup).
  3. After a while (let's say 1 day) we discovered we used not latest backup, but backup from month ago. We cannot just shutdown API and restore from latest backup, because users already created data for 1 day.

State: on our prod DB 1 month of production data has been lost. But in the same time we have this gap inside backup.

Question: what is best solution to merge missing data to existing prod? Better with no downtime.

P.S. Because if this we had to create some data manually, for example, recreate some users. What gonna happen when we merge these 2 DBs?

  • I would take the hit on the downtime if I were you, rather than taking on lost data! Stop your server - restore as best you can. Input the data created for 1 day and then restart. I hope you have some sort of auditing on your tables/documents so you can tell when they were created/modified/deleted? If you don't, well then, you should start now!
    – Vérace
    Commented May 28, 2018 at 11:16

1 Answer 1


Bring second instance up, restore data to that instance. Then mongoexport data to json files what you can mongoimport to current mongodb with "--mode upsert --upsertFields '_id'" (using _id as a key)

  • Can I do mongoimport against running mongodb? If yes, do you know how does it affect performance?
    – IliaEremin
    Commented May 28, 2018 at 17:43
  • Yes, you can run mongoimport against running instance, hit to the performance is same than you have very active client.. So, normally not that bad
    – JJussi
    Commented May 29, 2018 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.