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β()