com.mongodb
Class WriteConcern

java.lang.Object
  extended by com.mongodb.WriteConcern

public class WriteConcern
extends Object

WriteConcern control the write behavior for with various options, as well as exception raising on error conditions.

w -1 = don't even report network errors 0 = default, don't call getLastError by default 1 = basic, call getLastError, but don't wait for slaves 2+= wait for slaves wtimeout how long to wait for slaves before failing 0 = indefinite > 0 = ms to wait fsync force fsync to disk


MongoDB Doc Links

Field Summary
static WriteConcern FSYNC_SAFE
           
static WriteConcern NONE
           
static WriteConcern NORMAL
           
static WriteConcern REPLICAS_SAFE
           
static WriteConcern SAFE
           
static WriteConcern STRICT
          Deprecated. 
 
Constructor Summary
WriteConcern()
           
WriteConcern(int w)
           
WriteConcern(int w, int wtimeout)
           
WriteConcern(int w, int wtimeout, boolean fsync)
           
 
Method Summary
 boolean callGetLastError()
           
 boolean fsync()
           
 BasicDBObject getCommand()
           
 int getW()
           
 int getWtimeout()
           
 boolean raiseNetworkErrors()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final WriteConcern NONE

NORMAL

public static final WriteConcern NORMAL

SAFE

public static final WriteConcern SAFE

STRICT

@Deprecated
public static final WriteConcern STRICT
Deprecated. 

FSYNC_SAFE

public static final WriteConcern FSYNC_SAFE

REPLICAS_SAFE

public static final WriteConcern REPLICAS_SAFE
Constructor Detail

WriteConcern

public WriteConcern()

WriteConcern

public WriteConcern(int w)

WriteConcern

public WriteConcern(int w,
                    int wtimeout)

WriteConcern

public WriteConcern(int w,
                    int wtimeout,
                    boolean fsync)
Method Detail

getCommand

public BasicDBObject getCommand()

getW

public int getW()
Returns:
the number of servers to write to

getWtimeout

public int getWtimeout()
Returns:
the write timeout (in milliseconds)

fsync

public boolean fsync()
Returns:
If files are sync'd to disk.

raiseNetworkErrors

public boolean raiseNetworkErrors()

callGetLastError

public boolean callGetLastError()

toString

public String toString()
Overrides:
toString in class Object