views:

42

answers:

1

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 in pymongo.

+1  A: 
 db.col1.update( { class : 12}, { $push : { roll : 5 } } )
Thilo
nice. but lust is ")", not "}"
walla
thanks, fixed (though it is probably still more pseudo-syntax or JS-syntax than Python, but one should get the idea).
Thilo