开发者

How come a document in MongoDB sometimes gets inserted , but most often don't?

con = pymongo.Connection('localhost',27017)
db = con.MouseDB

post = { ...some s开发者_运维问答tuff }
datasets = db.datasets
datasets.insert(post)

So far, there are only 3 records, and it's supposed to have about 100...


Did you check to make sure that you don't have collisions on your primary keys. Take a look at the console and it should tell you why a document is not inserting. I'd also recommend trying to insert one at a time from the command line tool to get better information as to why it may not be inserting correctly. If you want to update, make sure to use save instead of insert (which performs an upsert)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜