com.mongodb
Class WriteResult

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

public class WriteResult
extends Object

This class lets you access the results of the previous write. if you have STRICT mode on, this just stores the result of that getLastError call if you don't, then this will actually do the getlasterror call. if another operation has been done on this connection in the interim, calls will fail


Method Summary
 CommandResult getCachedLastError()
          Gets the last result from getLastError()
 String getError()
          Gets the error String ("err" field)
 Object getField(String name)
          Gets a field
 WriteConcern getLastConcern()
          Gets the last WriteConcern used when calling getLastError()
 CommandResult getLastError()
          calls getLastError(com.mongodb.WriteConcern) with concern=null
 CommandResult getLastError(WriteConcern concern)
          This method does following: - returns the existing CommandResult if concern is null or less strict than the concern it was obtained with - otherwise attempts to obtain a CommandResult by calling getLastError with the concern
 int getN()
          Gets the "n" field, which contains the number of documents affected in the write operation.
 boolean isLazy()
          Returns whether or not the result is lazy, meaning that getLastError was not called automatically
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCachedLastError

public CommandResult getCachedLastError()
Gets the last result from getLastError()

Returns:

getLastConcern

public WriteConcern getLastConcern()
Gets the last WriteConcern used when calling getLastError()

Returns:

getLastError

public CommandResult getLastError()
calls getLastError(com.mongodb.WriteConcern) with concern=null

Returns:
Throws:
MongoException

getLastError

public CommandResult getLastError(WriteConcern concern)
This method does following: - returns the existing CommandResult if concern is null or less strict than the concern it was obtained with - otherwise attempts to obtain a CommandResult by calling getLastError with the concern

Parameters:
concern - the concern
Returns:
Throws:
MongoException

getError

public String getError()
Gets the error String ("err" field)

Returns:
Throws:
MongoException

getN

public int getN()
Gets the "n" field, which contains the number of documents affected in the write operation.

Returns:
Throws:
MongoException

getField

public Object getField(String name)
Gets a field

Parameters:
name - field name
Returns:
Throws:
MongoException

isLazy

public boolean isLazy()
Returns whether or not the result is lazy, meaning that getLastError was not called automatically

Returns:

toString

public String toString()
Overrides:
toString in class Object