public abstract class WriteConcernResult extends Object
wasAcknowledged will return false and all
other methods will throw MongoUnacknowledgedWriteException.WriteConcern.UNACKNOWLEDGED| Constructor | Description |
|---|---|
WriteConcernResult() |
| Modifier and Type | Method | Description |
|---|---|---|
static WriteConcernResult |
acknowledged(int count,
boolean isUpdateOfExisting,
BsonValue upsertedId) |
Create an acknowledged WriteConcernResult
|
abstract int |
getCount() |
Returns the number of documents affected by the write operation.
|
abstract BsonValue |
getUpsertedId() |
Returns the value of _id if this write resulted in an upsert.
|
abstract boolean |
isUpdateOfExisting() |
Returns true if the write was an update of an existing document.
|
static WriteConcernResult |
unacknowledged() |
Create an unacknowledged WriteConcernResult
|
abstract boolean |
wasAcknowledged() |
Returns true if the write was acknowledged.
|
public abstract boolean wasAcknowledged()
public abstract int getCount()
UnsupportedOperationException - if the write was unacknowledged.public abstract boolean isUpdateOfExisting()
UnsupportedOperationException - if the write was unacknowledged.@Nullable public abstract BsonValue getUpsertedId()
UnsupportedOperationException - if the write was unacknowledged.public static WriteConcernResult acknowledged(int count, boolean isUpdateOfExisting, @Nullable BsonValue upsertedId)
count - the count of matched documentsisUpdateOfExisting - whether an existing document was updatedupsertedId - if an upsert resulted in an inserted document, this is the _id of that document. This may be nullpublic static WriteConcernResult unacknowledged()