|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.vz.mongodb.jackson.WriteResult<T,K>
public class WriteResult<T,K>
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 This class also gives you access to the saved objects, for the purposes of finding out the objects ids, if they were generated by MongoDB.
Constructor Summary | |
---|---|
protected |
WriteResult(JacksonDBCollection<T,K> jacksonDBCollection,
com.mongodb.WriteResult writeResult,
com.mongodb.DBObject... dbObjects)
|
Method Summary | |
---|---|
com.mongodb.CommandResult |
getCachedLastError()
Gets the last result from getLastError() |
com.mongodb.DBObject |
getDbObject()
Get the underlying DBObject that was serialised before it was saved. |
com.mongodb.DBObject[] |
getDbObjects()
Get the underlying DBObjects that were serialised before they were saved. |
String |
getError()
Gets the error String ("err" field) |
Object |
getField(String name)
Gets a field |
com.mongodb.WriteConcern |
getLastConcern()
Gets the last WriteConcern used when calling getLastError() |
com.mongodb.CommandResult |
getLastError()
calls getLastError(com.mongodb.WriteConcern) with concern=null |
com.mongodb.CommandResult |
getLastError(com.mongodb.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. |
K |
getSavedId()
Get the saved ID. |
K[] |
getSavedIds()
Get the saved IDs. |
T |
getSavedObject()
Get the object that was saved. |
T[] |
getSavedObjects()
Get the objects that were saved. |
com.mongodb.WriteResult |
getWriteResult()
The underlying write result |
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 |
Constructor Detail |
---|
protected WriteResult(JacksonDBCollection<T,K> jacksonDBCollection, com.mongodb.WriteResult writeResult, com.mongodb.DBObject... dbObjects)
Method Detail |
---|
public T getSavedObject()
com.mongodb.MongoException
- If no objects were savedpublic T[] getSavedObjects()
public K getSavedId()
com.mongodb.MongoException
- If no objects were savedpublic K[] getSavedIds()
public com.mongodb.DBObject getDbObject()
com.mongodb.MongoException
- If no objects were savedpublic com.mongodb.DBObject[] getDbObjects()
public com.mongodb.WriteResult getWriteResult()
public com.mongodb.CommandResult getCachedLastError()
public com.mongodb.WriteConcern getLastConcern()
WriteConcern
used when calling getLastError()
public com.mongodb.CommandResult getLastError()
getLastError(com.mongodb.WriteConcern)
with concern=null
public com.mongodb.CommandResult getLastError(com.mongodb.WriteConcern concern)
concern
- the concern
public String getError()
public int getN()
public Object getField(String name)
name
- field name
public boolean isLazy()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |