java.lang.Object | |
↳ | com.mongodb.WriteConcern |
Known Direct Subclasses |
WriteConcern control the write behavior for with various options, as well as exception raising on error conditions.
w
fsync force fsync to disk
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
WriteConcern.Majority |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FSYNC_SAFE | Exceptions are raised for network issues, and server errors; the write operation waits for the server to flush the data to disk | ||||||||||
JOURNAL_SAFE | Exceptions are raised for network issues, and server errors; the write operation waits for the server to group commit to the journal file on disk | ||||||||||
MAJORITY | Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation | ||||||||||
NONE | No exceptions are raised, even for network issues | ||||||||||
NORMAL | Exceptions are raised for network issues, but not server errors | ||||||||||
REPLICAS_SAFE | Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation | ||||||||||
SAFE | Exceptions are raised for network issues, and server errors; waits on a server for the write operation |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor keeping all options as default
| |||||||||||
Calls
WriteConcern(int, int, boolean) with wtimeout=0 and fsync=false | |||||||||||
Tag based Write Concern with wtimeout=0, fsync=false, and j=false
| |||||||||||
Calls
WriteConcern(int, int, boolean) with fsync=false | |||||||||||
Calls
WriteConcern(int, int, boolean) with w=1 and wtimeout=0 | |||||||||||
Creates a WriteConcern object.
| |||||||||||
Creates a WriteConcern object.
| |||||||||||
Creates a WriteConcern object.
| |||||||||||
Creates a WriteConcern object.
| |||||||||||
Creates a WriteConcern object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns whether "getlasterror" should be called (w > 0)
| |||||||||||
Toggles the "continue inserts on error" mode.
| |||||||||||
Gets the fsync flag (fsync to disk on the server)
| |||||||||||
Gets the "continue inserts on error" mode
| |||||||||||
Gets the fsync flag (fsync to disk on the server)
| |||||||||||
Gets the j parameter (journal syncing)
| |||||||||||
Gets the w parameter (the write strategy)
| |||||||||||
Gets the w value (the write strategy)
| |||||||||||
Gets the w parameter (the write strategy) in String format
| |||||||||||
Gets the write timeout (in milliseconds)
| |||||||||||
Create a Majority Write Concern that requires a majority of
servers to acknowledge the write.
| |||||||||||
Returns whether network error may be raised (w >= 0)
| |||||||||||
Sets the w value (the write strategy)
| |||||||||||
Gets the WriteConcern constants by name: NONE, NORMAL, SAFE, FSYNC_SAFE,
REPLICA_SAFE.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Exceptions are raised for network issues, and server errors; the write operation waits for the server to flush the data to disk
Exceptions are raised for network issues, and server errors; the write operation waits for the server to group commit to the journal file on disk
Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation
Exceptions are raised for network issues, but not server errors
Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation
Exceptions are raised for network issues, and server errors; waits on a server for the write operation
Default constructor keeping all options as default
Calls WriteConcern(int, int, boolean)
with wtimeout=0 and fsync=false
w | number of writes |
---|
Tag based Write Concern with wtimeout=0, fsync=false, and j=false
w | Write Concern tag |
---|
Calls WriteConcern(int, int, boolean)
with fsync=false
w | number of writes |
---|---|
wtimeout | timeout for write operation |
Calls WriteConcern(int, int, boolean)
with w=1 and wtimeout=0
fsync | whether or not to fsync |
---|
Creates a WriteConcern object.
Specifies the number of servers to wait for on the write operation, and exception raising behavior
w represents the number of servers:
w=-1
None, no checking is donew=0
None, network socket errors raisedw=1
Checks server for errors as well as network socket errors raisedw>1
Checks servers (w) for errors as well as network socket errors raisedw | number of writes |
---|---|
wtimeout | timeout for write operation |
fsync | whether or not to fsync |
Creates a WriteConcern object.
Specifies the number of servers to wait for on the write operation, and exception raising behavior
w represents the number of servers:
w=-1
None, no checking is donew=0
None, network socket errors raisedw=1
Checks server for errors as well as network socket errors raisedw>1
Checks servers (w) for errors as well as network socket errors raisedw | number of writes |
---|---|
wtimeout | timeout for write operation |
fsync | whether or not to fsync |
j | whether writes should wait for a journaling group commit |
Creates a WriteConcern object.
Specifies the number of servers to wait for on the write operation, and exception raising behavior
w represents the number of servers:
w=-1
None, no checking is donew=0
None, network socket errors raisedw=1
Checks server for errors as well as network socket errors raisedw>1
Checks servers (w) for errors as well as network socket errors raisedw | number of writes |
---|---|
wtimeout | timeout for write operation |
fsync | whether or not to fsync |
j | whether writes should wait for a journaling group commit |
continueOnInsertError | if batch inserts should continue after the first error |
Creates a WriteConcern object.
Specifies the number of servers to wait for on the write operation, and exception raising behavior
w represents the number of servers:
w=-1
None, no checking is donew=0
None, network socket errors raisedw=1
Checks server for errors as well as network socket errors raisedw>1
Checks servers (w) for errors as well as network socket errors raisedw | number of writes |
---|---|
wtimeout | timeout for write operation |
fsync | whether or not to fsync |
j | whether writes should wait for a journaling group commit |
Creates a WriteConcern object.
Specifies the number of servers to wait for on the write operation, and exception raising behavior
w represents the number of servers:
w=-1
None, no checking is donew=0
None, network socket errors raisedw=1
Checks server for errors as well as network socket errors raisedw>1
Checks servers (w) for errors as well as network socket errors raisedw | number of writes |
---|---|
wtimeout | timeout for write operation |
fsync | whether or not to fsync |
j | whether writes should wait for a journaling group commit |
continueOnInsertError | if batch inserts should continue after the first error |
Returns whether "getlasterror" should be called (w > 0)
Toggles the "continue inserts on error" mode. This only applies to server side errors. If there is a document which does not validate in the client, an exception will still be thrown in the client. This will return a *NEW INSTANCE* of WriteConcern with your preferred continueOnInsert value
Gets the fsync flag (fsync to disk on the server)
Gets the "continue inserts on error" mode
Gets the fsync flag (fsync to disk on the server)
Gets the j parameter (journal syncing)
Gets the w parameter (the write strategy)
Gets the write timeout (in milliseconds)
Create a Majority Write Concern that requires a majority of servers to acknowledge the write.
wtimeout | timeout for write operation |
---|---|
fsync | whether or not to fsync |
j | whether writes should wait for a journaling group commit |
Returns whether network error may be raised (w >= 0)
Gets the WriteConcern constants by name: NONE, NORMAL, SAFE, FSYNC_SAFE, REPLICA_SAFE. (matching is done case insensitively)