I have a website that's running on a production server, backed by mongodb. Every hour or so, some new data becomes available that I want to add to the db, inserting new documents, and updating old ones.
I get the new data on a development server, and update the dev server's copy of the db. If everything looks good, I want to send the new info to the production db, so that production now looks the same as dev's db. If tests fail, don't send changes to production until they pass. The changes I have in mind are not schema changes, but just new values for old fields, and new documents with the same fields as the others.
Several options occur to me for how to do this.
- With every update, do
{$set: {data_field: new_value, modified: ISODate()})
and then copy everything with appropriate modified to production.
With every update, write the update command to a log, then run all of these commands on production.
With every update, tail the oplog, and run all of the commands in the update on production.
Are all of these common approaches? I'd like to make this as low-maintenance as possible within standard practice. How can I decide between these methods?