Skip to content

Instantly share code, notes, and snippets.

@hirofumi
Last active December 16, 2015 07:59
Show Gist options
  • Save hirofumi/5402536 to your computer and use it in GitHub Desktop.
Save hirofumi/5402536 to your computer and use it in GitHub Desktop.
A Memorandum of WriteConcern of MongoDB

Options

option
w number of servers to wait for on the write operation, and exception raising behavior
wtimeout how long to wait for slaves before failing
j whether writes should wait for a journaling group commit
fsync whether or not to fsync
w
-1 Don't even report network errors
0 Don't wait for acknowledgement from the server
1 Wait for acknowledgement, but don't wait for secondaries to replicate
>= 2 Wait for one or more secondaries to also acknowledge
wtimeout
0 indefinite
n > 0 n milliseconds
w wtimeout fsync j
ERRORS_IGNORED, NONE -1 0 false false
ACKNOWLEDGED, SAFE 1 0 false false
UNACKNOWLEDGED, NORMAL 0 0 false false
FSYNCED, FSYNC_SAFE 1 0 true false
JOURNALED, JOURNAL_SAFE 1 0 false true
REPLICA_ACKNOWLEDGED, REPLICAS_SAFE 2 0 false false

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment