public class WriteResult extends Object
UnsupportedOperationException
.WriteConcern.UNACKNOWLEDGED
Constructor | Description |
---|---|
WriteResult(int n,
boolean updateOfExisting,
Object upsertedId) |
Construct a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
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 |
isUpdateOfExisting() |
Returns true if this write resulted in an update of an existing document.
|
String |
toString() |
|
static WriteResult |
unacknowledged() |
Gets an instance representing an unacknowledged write.
|
boolean |
wasAcknowledged() |
Returns true if the write was acknowledged.
|
public WriteResult(int n, boolean updateOfExisting, @Nullable Object upsertedId)
n
- the number of existing documents affected by this operationupdateOfExisting
- true if the operation was an update and an existing document was updatedupsertedId
- the _id of a document that was upserted by this operation, which may be nullpublic static WriteResult unacknowledged()
public boolean wasAcknowledged()
WriteConcern.UNACKNOWLEDGED
public int getN()
UnsupportedOperationException
- if the write was unacknowledgedWriteConcern.UNACKNOWLEDGED
@Nullable public Object getUpsertedId()
UnsupportedOperationException
- if the write was unacknowledgedpublic boolean isUpdateOfExisting()
UnsupportedOperationException
- if the write was unacknowledged