Let's say I insert the document.
post = { some dictionary }
mongo_id = mycollection.insert(post)
Now, let's say I want to add a field and update it. How do I do that? This doesn't seem to work.....
post = mycollection.find_one({"_id":mongo_id})
post['newfield'] = "abc"
mycollection.save(post)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…