开发者

How to update mongodb collections

开发者 https://www.devze.com 2023-01-20 18:48 出处:网络
My collection structure is: col1 = {\'class\':\'12\', \'roll\':[1, 2, 3, 4]开发者_开发技巧} Now, I want to update the collection col1 to

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

精彩评论

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