Insert data with new fields OR update conditionally using updateOne mongodb
I have a document with format like this: { "f1": "v1", "f2": { "id": 1, "sub": "subv", "updatedAt": 123 } } I have an another source that give me a inputf2 object. I want to write an upsert query to…