1

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 ?

scoulomb
  • 630
  • 2
  • 7
  • 19

1 Answers1

2

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.

Justin Case
  • 1,503
  • 11
  • 20
  • 2
    Please note that 2.6 errors out with j:true if journal is disabled, where 2.4 just ignores j:true: http://docs.mongodb.org/manual/reference/write-concern/ Be aware of performance implications of j:true - it will limit the rate of inserts to 30/sec per each thread, because journalCommitInterval will be 30msec and each write with j:true will have to wait for journal to commit. – Alex Komyagin Jul 26 '14 at 03:21
  • You are absolutely right. I just used it for testing pymongo. `j` defaults to `False` anyhow. – Justin Case Jul 26 '14 at 05:13
  • Thx. Your answer and comments leads me to new questions : http://stackoverflow.com/questions/25344559/mongodb-journaling-is-the-journal-file-used-when-the-client-request-a-non-jour – scoulomb Aug 16 '14 at 22:32