开发者

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 } } )
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜