public class WriteResult extends Object
Modifier and Type | Method and Description |
---|---|
CommandResult |
getCachedLastError()
Deprecated.
Use the appropriate
WriteConcern and rely on the write operation to throw an exception on failure. For
successful writes, use the helper methods to retrieve specific values from the write response. |
String |
getError()
Deprecated.
There should be no reason to use this method. The error message will be in the exception thrown for an
unsuccessful write operation.
|
Object |
getField(String name)
Deprecated.
There should be no reason to use this method. To get specific fields from a successful write,
use the helper methods provided. Any error-related fields will be in the exception thrown for an unsuccessful write operation.
|
WriteConcern |
getLastConcern()
Gets the last
WriteConcern used when calling getLastError(). |
CommandResult |
getLastError()
Deprecated.
Use the appropriate
WriteConcern and allow the write operation to throw an exception on failure. For
successful writes, use the helper methods to retrieve specific values from the write response. |
CommandResult |
getLastError(WriteConcern concern)
Deprecated.
Use the appropriate
WriteConcern and rely on the write operation to throw an
exception on failure. For successful writes, use the helper methods to retrieve specific values from the write response. |
int |
getN()
Gets the "n" field, which contains the number of documents
affected in the write operation.
|
Object |
getUpsertedId()
Gets the _id value of an upserted document that resulted from this write.
|
boolean |
isLazy()
Deprecated.
Call
WriteResult.getLastConcern().isAcknowledged() instead |
boolean |
isUpdateOfExisting()
Returns true if this write resulted in an update of an existing document.
|
String |
toString() |
@Deprecated public CommandResult getCachedLastError()
WriteConcern
and rely on the write operation to throw an exception on failure. For
successful writes, use the helper methods to retrieve specific values from the write response.getN()
,
getUpsertedId()
,
isUpdateOfExisting()
public WriteConcern getLastConcern()
WriteConcern
used when calling getLastError().@Deprecated public CommandResult getLastError()
WriteConcern
and allow the write operation to throw an exception on failure. For
successful writes, use the helper methods to retrieve specific values from the write response.getLastError(com.mongodb.WriteConcern)
with a null write concern.MongoException
getN()
,
getUpsertedId()
,
isUpdateOfExisting()
@Deprecated public CommandResult getLastError(WriteConcern concern)
WriteConcern
and rely on the write operation to throw an
exception on failure. For successful writes, use the helper methods to retrieve specific values from the write response.concern
- the concernMongoException
getN()
,
getUpsertedId()
,
isUpdateOfExisting()
@Deprecated public String getError()
"err"
field).MongoException
public int getN()
MongoException
public Object getUpsertedId()
public boolean isUpdateOfExisting()
@Deprecated public Object getField(String name)
name
- field nameMongoException
getN()
,
getUpsertedId()
,
isUpdateOfExisting()
@Deprecated public boolean isLazy()
WriteResult.getLastConcern().isAcknowledged()
instead