My dataset is complete in the DB; however I want to create a new field on each of the documents in the db. This new field I want to be derived by some of my input along with other fields that are currently in the database:
IE:
Document:
{
"_id":myId,
"city":"fooville",
"state":"bar"
}
Then I want to take and iterate through every entry and add something like this:
Document:
{
"_id":myId,
"city":"fooville",
"state":"bar",
"cityState":"fooville, bar"
}
Is there an easy way to do this? Trying to avoid re-inserting the entire dataset.
Thank you in advance for your help
(Mongo is awesome)
Something like this:
I haven’t tested it….but it should work…