In addition to --journal
, which is enabled by default, since MongoDB 2.0 ( only on 64-bit machines), there is a flag that you can set when saving data:
safe => false
: don't wait for db responsesafe => true
: wait for db responsesafe => num
: wait for many servers to have a record before returningfsync => true
: write fsync to disk before returning. fsync => true
implies safe=>true
, but not vice versa.
If fsync=>false
and safe=>true
and the record can be successfully applied to the mmapped file, but not yet written to disk
source share