Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 pymongo(自 2.4 起)时,执行此操作时:
m = pymongo.MongoClient() m.write_concern = {'w': 2} m.write_concern['j'] = True
我们指定我们想要确认(在 2 个副本上)和日志写入。
如果我们在写问题中没有提及,根据这篇文章,默认情况下它听起来像 w = 1 。但是,当我们什么都不指定时,日志的默认模式是什么,它是 j= True 还是 False ?
该j选项是False默认的。在 上禁用日记功能后mongod,将成功插入具有默认设置的文档。如果默认j情况True下它会引发异常。
j
False
mongod
True