public abstract class BulkWriteResult
extends java.lang.Object
Constructor and Description |
---|
BulkWriteResult() |
Modifier and Type | Method and Description |
---|---|
static BulkWriteResult |
acknowledged(int insertedCount,
int matchedCount,
int removedCount,
java.lang.Integer modifiedCount,
java.util.List<BulkWriteUpsert> upserts)
Create an acknowledged BulkWriteResult
|
static BulkWriteResult |
acknowledged(WriteRequest.Type type,
int count,
java.lang.Integer modifiedCount,
java.util.List<BulkWriteUpsert> upserts)
Create an acknowledged BulkWriteResult
|
static BulkWriteResult |
acknowledged(WriteRequest.Type type,
int count,
java.util.List<BulkWriteUpsert> upserts)
Create an acknowledged BulkWriteResult
|
abstract int |
getDeletedCount()
Returns the number of documents deleted by the write operation.
|
abstract int |
getInsertedCount()
Returns the number of documents inserted by the write operation.
|
abstract int |
getMatchedCount()
Returns the number of documents matched by updates or replacements in the write operation.
|
abstract int |
getModifiedCount()
Returns the number of documents modified by the write operation.
|
abstract java.util.List<BulkWriteUpsert> |
getUpserts()
Gets an unmodifiable list of upserted items, or the empty list if there were none.
|
abstract boolean |
isModifiedCountAvailable()
Returns true if the server was able to provide a count of modified documents.
|
static BulkWriteResult |
unacknowledged()
Create an unacknowledged BulkWriteResult
|
abstract boolean |
wasAcknowledged()
Returns true if the write was acknowledged.
|
public abstract boolean wasAcknowledged()
WriteConcern.UNACKNOWLEDGED
public abstract int getInsertedCount()
java.lang.UnsupportedOperationException
- if the write was unacknowledged.WriteConcern.UNACKNOWLEDGED
public abstract int getMatchedCount()
java.lang.UnsupportedOperationException
- if the write was unacknowledged.WriteConcern.UNACKNOWLEDGED
public abstract int getDeletedCount()
java.lang.UnsupportedOperationException
- if the write was unacknowledged.WriteConcern.UNACKNOWLEDGED
public abstract boolean isModifiedCountAvailable()
getModifiedCount
method will throw UnsupportedOperationException
.java.lang.UnsupportedOperationException
- if the write was unacknowledged.WriteConcern.UNACKNOWLEDGED
,
getModifiedCount()
public abstract int getModifiedCount()
If the server is not able to provide a count of modified documents (which can happen if the server is not at least version 2.6),
then this method will throw an UnsupportedOperationException
java.lang.UnsupportedOperationException
- if the write was unacknowledged or if no modified count is available.WriteConcern.UNACKNOWLEDGED
,
isModifiedCountAvailable()
public abstract java.util.List<BulkWriteUpsert> getUpserts()
java.lang.UnsupportedOperationException
- if the write was unacknowledged.WriteConcern.UNACKNOWLEDGED
public static BulkWriteResult acknowledged(WriteRequest.Type type, int count, java.util.List<BulkWriteUpsert> upserts)
type
- the type of the writecount
- the number of documents matchedupserts
- the list of upsertspublic static BulkWriteResult acknowledged(WriteRequest.Type type, int count, java.lang.Integer modifiedCount, java.util.List<BulkWriteUpsert> upserts)
type
- the type of the writecount
- the number of documents matchedmodifiedCount
- the number of documents modified, which may be null if the server was not able to provide the countupserts
- the list of upsertspublic static BulkWriteResult acknowledged(int insertedCount, int matchedCount, int removedCount, java.lang.Integer modifiedCount, java.util.List<BulkWriteUpsert> upserts)
insertedCount
- the number of documents inserted by the write operationmatchedCount
- the number of documents matched by the write operationremovedCount
- the number of documents removed by the write operationmodifiedCount
- the number of documents modified, which may be null if the server was not able to provide the countupserts
- the list of upsertspublic static BulkWriteResult unacknowledged()