mongodbpymongoinsertionjournaldurability

Pymongo default journaling


When using pymongo (since 2.4), when doing this :

m = pymongo.MongoClient()
m.write_concern = {'w': 2}
m.write_concern['j'] = True

We specify that we want acknowledged (on 2 replicas) and journaled write.

If we mention nothing in the write concern it sounds like w = 1 by default according to this post. But what is the deault mode for journaling when we specify nothing, is it j= True or False ?


Solution

  • The j option is False by default. With journaling disabled on the mongod, inserting a document with default settings succeeds. If j was True by default it would have raised an exception.