pymongo collection.update command sometimes doesn't write to MongoDB

40 views
Skip to first unread message

Pouria Mojabi

unread,
Nov 30, 2015, 9:20:23 PM11/30/15
to mongodb-user
Hi Guys, 

My gratitude for the help in advance. 

I am using pymongo to push to MongoDB and I have a simple update command
res = db.user.update({"_id":ObjectId(userid)}, {'$set': {"blah":array}})

Even though "res" reports success, no data is pushed to MongoDB. I am very puzzled ... it happens one out of ten attempts 

Appreciate any thoughts
Thank you
p

Rhys Campbell

unread,
Dec 3, 2015, 3:37:24 AM12/3/15
to mongodb-user

Bernie Hackett

unread,
Dec 3, 2015, 4:55:29 PM12/3/15
to mongodb-user
When you say "res reports success" what are you referring to? If there was no error, and you have a document for "res", then the server processed the update. But that doesn't mean that the update actually modified any documents. What versions of PyMongo and MongoDB are you using?

Pouria Mojabi

unread,
May 13, 2016, 2:53:11 AM5/13/16
to mongodb-user
So for some reason I wasn't notified of your reply, I apologize. Thanks for your help
I am using python 2.7 and Mongo 3.2.6 and pymongo 3.2

Pouria Mojabi

unread,
May 13, 2016, 2:54:07 AM5/13/16
to mongodb-user
by res report success i mean, the document has the pushed data, but it is not reflected in mongodb


On Thursday, December 3, 2015 at 1:55:29 PM UTC-8, Bernie Hackett wrote:

Bernie Hackett

unread,
May 13, 2016, 3:35:55 PM5/13/16
to mongodb-user
Please post reproduction steps (example data to update, the update call, the result document, and what you expect the result to be on the server side).
Reply all
Reply to author
Forward
0 new messages