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