public class WriteResult
extends java.lang.Object
UnsupportedOperationException
.WriteConcern.UNACKNOWLEDGED
Constructor and Description |
---|
WriteResult(int n,
boolean updateOfExisting,
java.lang.Object upsertedId)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getN()
Gets the "n" field, which contains the number of documents affected in the write operation.
|
java.lang.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.
|
java.lang.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, java.lang.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 operationpublic static WriteResult unacknowledged()
public boolean wasAcknowledged()
WriteConcern.UNACKNOWLEDGED
public int getN()
java.lang.UnsupportedOperationException
- if the write was unacknowledgedWriteConcern.UNACKNOWLEDGED
public java.lang.Object getUpsertedId()
java.lang.UnsupportedOperationException
- if the write was unacknowledgedpublic boolean isUpdateOfExisting()
java.lang.UnsupportedOperationException
- if the write was unacknowledgedpublic java.lang.String toString()
toString
in class java.lang.Object