Since you're using MongoDB 3.4.7 with WiredTiger, there are certain defaults in place if you run MongoDB with the default values (journal is enabled):
If you run MongoDB without journaling, using {w:'majority', j:true}
will result in an error (see the Note section on j option):
[PRIMARY:replset] test> db.test.insert({a:1},{writeConcern:{w:'majority', j:true}})
WriteResult({
"writeError": {
"code": 2,
"errmsg": "cannot use 'j' option when a host does not have journaling enabled"
}
})
Please note that counter-intuitively, running WiredTiger with the --nojournal
option may make it slower. This is because WiredTiger performs a checkpoint every 60 seconds or 2 GB of data in MongoDB 3.4, and writes to the journal between checkpoints.
Disabling journaling will force any journal flushes to become a checkpoint instead. Since a journal sync is relatively lightweight compared to a full checkpoint, the forced checkpoints will slow down WiredTiger.