Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- _id : ...,
- other_stuff ... ,
- my_array : [
- { ... old content A ... },
- { ... old content B ... },
- { ... old content C ... }
- ]
- }
- {
- _id : ...,
- other_stuff ... ,
- my_array : [
- { ... old content A ... },
- { ... NEW content B ... },
- { ... old content C ... }
- ]
- }
- db.my_collection.update(
- {_id: ObjectId(document_id), my_array.1 : 1 },
- {my_array.$.content: NEW content B }
- )
- db["my_collection"].update(
- { "_id": ObjectId(document_id) },
- { "$set": { 'documents.'+str(doc_index)+'.content' : new_content_B}}
- )
- db.my_collection.update(
- {_id : "document_id"},
- {$set : {"my_array.1.content" : "New content B"}}
- db.my_collection.update(
- {_id: ObjectId(document_id), my_array.1 : 1 },
- { $set: { "my_array.$.content" : "NEW content B" } }
- )
- db.my_collection.update(
- {_id: ObjectId(document_id), my_array : { ... old content A ... } },
- { $set: { "my_array.$.content" : "NEW content B" } }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement