public abstract class UpdateResult extends Object
wasAcknowledged
will return false and all other
methods will throw UnsupportedOperationException
.WriteConcern.UNACKNOWLEDGED
Constructor | Description |
---|---|
UpdateResult() |
Modifier and Type | Method | Description |
---|---|---|
static UpdateResult |
acknowledged(long matchedCount,
Long modifiedCount,
BsonValue upsertedId) |
Create an acknowledged UpdateResult
|
abstract long |
getMatchedCount() |
Gets the number of documents matched by the query.
|
abstract long |
getModifiedCount() |
Gets the number of documents modified by the update.
|
abstract BsonValue |
getUpsertedId() |
If the replace resulted in an inserted document, gets the _id of the inserted document, otherwise null.
|
abstract boolean |
isModifiedCountAvailable() |
Gets a value indicating whether the modified count is available.
|
static UpdateResult |
unacknowledged() |
Create an unacknowledged UpdateResult
|
abstract boolean |
wasAcknowledged() |
Returns true if the write was acknowledged.
|
public abstract boolean wasAcknowledged()
public abstract long getMatchedCount()
public abstract boolean isModifiedCountAvailable()
The modified count is only available when all servers have been upgraded to 2.6 or above.
public abstract long getModifiedCount()
@Nullable public abstract BsonValue getUpsertedId()
public static UpdateResult acknowledged(long matchedCount, @Nullable Long modifiedCount, @Nullable BsonValue upsertedId)
matchedCount
- the number of documents matchedmodifiedCount
- the number of documents modifiedupsertedId
- if the replace resulted in an inserted document, the id of the inserted documentpublic static UpdateResult unacknowledged()