Hello! I’m hoping someone has come up with a good strategy for something I’m looking to do, and can only assume someone else has looked to do the same previously.
We do development locally, then deploy changes to a staging server, and later to production. While developing, we may create various changes to documents, but let’s use one example… configuration information which may be updated by site managers. Here’s a (fake) example:
{
"_id" : ObjectId("12345"),
"font" : "Arial",
"color" : "#FFF",
"cotact" : "John Doe"
}
Once in production, these may be changed. Let’s say John Doe leaves, and someone updates the contact to be Jane Doe, and Jane prefers Helvetica so now production looks like.
{
"_id" : ObjectId("12345"),
"font" : "Helvetica",
"color" : "#FFF",
"cotact" : "Jane Doe"
}
In the meantime, a developer is changing that document (and maybe other similar ones) for new work, and their local document ends up like:
{
"_id" : ObjectId("98765"),
"font" : "Arial",
"color" : "#FFF",
"cotact" : "John Doe",
"phoneNumber": '555-555-5555'
}
When putting the latest code into production, I’d like whatever default values were created for this new development (here, ‘phoneNumber’) to be updated in staging, and later production. BUT, the other data in the document should not be updated so as not to lose the user’s changes or other things in staging. Ultimately, I’d want production to look like this:
{
"_id" : ObjectId("12345"),
"font" : "Helvetica",
"color" : "#FFF",
"cotact" : "Jane Doe",
[... any other new data added by other changes ...]
"phoneNumber": '555-555-5555'
}
Is there a good, somewhat automatic, way to get this done? Updating by hand can be tedious, and prone to human error, especially if there are many changes. How are others handling these sorts of changes?
Thanks for any input!