public class

WriteResult

extends Object
java.lang.Object
   ↳ com.mongodb.WriteResult

Class Overview

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

Summary

Public Methods
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()
synchronized 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
synchronized CommandResult getLastError()
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()
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public CommandResult getCachedLastError ()

Gets the last result from getLastError()

public String getError ()

Gets the error String ("err" field)

public Object getField (String name)

Gets a field

Parameters
name field name

public WriteConcern getLastConcern ()

Gets the last WriteConcern used when calling getLastError()

public synchronized 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

public synchronized CommandResult getLastError ()

public int getN ()

Gets the "n" field, which contains the number of documents affected in the write operation.

public boolean isLazy ()

Returns whether or not the result is lazy, meaning that getLastError was not called automatically

public String toString ()