MongoDB How to add a field to ALL embedded documents in an array
If I have some documents inside a collection. In this format: {posts: [{"name": "post1"},..., {"name": "postN"}]} What is the equivalent of this function: db.my_collection.update({}, { $set: {"posts.0.lastMod": new Date()}}, false, true) But to update all the embedded documents instead of…