How to update mongodb collections
My collection structure is:
col1 = {'class':'12', 'roll':[1, 2, 3, 4]开发者_开发技巧}
Now, I want to update
the collection col1
to
col1 = {'class':'12', 'roll':[1, 2, 3, 4, 5]}
I added another roll number here, How to update this collection in pymongo.
db.col1.update( { class : 12}, { $push : { roll : 5 } } )
精彩评论