Package com.mongodb.bulk
Class BulkWriteResult
java.lang.Object
com.mongodb.bulk.BulkWriteResult
The result of a successful bulk write operation.
- Since:
- 3.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BulkWriteResult
acknowledged
(int insertedCount, int matchedCount, int removedCount, Integer modifiedCount, List<BulkWriteUpsert> upserts) Deprecated.static BulkWriteResult
acknowledged
(int insertedCount, int matchedCount, int removedCount, Integer modifiedCount, List<BulkWriteUpsert> upserts, List<BulkWriteInsert> inserts) Create an acknowledged BulkWriteResultstatic BulkWriteResult
acknowledged
(com.mongodb.internal.bulk.WriteRequest.Type type, int count, Integer modifiedCount, List<BulkWriteUpsert> upserts) Deprecated.Preferacknowledged(int, int, int, Integer, List, List)
insteadstatic BulkWriteResult
acknowledged
(com.mongodb.internal.bulk.WriteRequest.Type type, int count, Integer modifiedCount, List<BulkWriteUpsert> upserts, List<BulkWriteInsert> inserts) Create an acknowledged BulkWriteResultstatic BulkWriteResult
acknowledged
(com.mongodb.internal.bulk.WriteRequest.Type type, int count, List<BulkWriteUpsert> upserts) Deprecated.Preferacknowledged(int, int, int, Integer, List, List)
insteadabstract int
Returns the number of documents deleted by the write operation.abstract int
Returns the number of documents inserted by the write operation.abstract List<BulkWriteInsert>
Gets an unmodifiable list of inserted items, or the empty list if there were none.abstract int
Returns the number of documents matched by updates or replacements in the write operation.abstract int
Returns the number of documents modified by the write operation.abstract List<BulkWriteUpsert>
Gets an unmodifiable list of upserted items, or the empty list if there were none.static BulkWriteResult
Create an unacknowledged BulkWriteResultabstract boolean
Returns true if the write was acknowledged.
-
Constructor Details
-
BulkWriteResult
public BulkWriteResult()
-
-
Method Details
-
wasAcknowledged
public abstract boolean wasAcknowledged()Returns true if the write was acknowledged.- Returns:
- true if the write was acknowledged
- See Also:
-
getInsertedCount
public abstract int getInsertedCount()Returns the number of documents inserted by the write operation.- Returns:
- the number of documents inserted by the write operation
- Throws:
UnsupportedOperationException
- if the write was unacknowledged.- See Also:
-
getMatchedCount
public abstract int getMatchedCount()Returns the number of documents matched by updates or replacements in the write operation. This will include documents that matched the query but where the modification didn't result in any actual change to the document; for example, if you set the value of some field, and the field already has that value, that will still count as an update.- Returns:
- the number of documents matched by updates in the write operation
- Throws:
UnsupportedOperationException
- if the write was unacknowledged.- See Also:
-
getDeletedCount
public abstract int getDeletedCount()Returns the number of documents deleted by the write operation.- Returns:
- the number of documents deleted by the write operation
- Throws:
UnsupportedOperationException
- if the write was unacknowledged.- See Also:
-
getModifiedCount
public abstract int getModifiedCount()Returns the number of documents modified by the write operation. This only applies to updates or replacements, and will only count documents that were actually changed; for example, if you set the value of some field , and the field already has that value, that will not count as a modification.- Returns:
- the number of documents modified by the write operation
- See Also:
-
getInserts
Gets an unmodifiable list of inserted items, or the empty list if there were none.- Returns:
- a list of inserted items, or the empty list if there were none.
- Throws:
UnsupportedOperationException
- if the write was unacknowledged.- Since:
- 4.0
- See Also:
-
getUpserts
Gets an unmodifiable list of upserted items, or the empty list if there were none.- Returns:
- a list of upserted items, or the empty list if there were none.
- Throws:
UnsupportedOperationException
- if the write was unacknowledged.- See Also:
-
acknowledged
@Deprecated public static BulkWriteResult acknowledged(com.mongodb.internal.bulk.WriteRequest.Type type, int count, List<BulkWriteUpsert> upserts) Deprecated.Preferacknowledged(int, int, int, Integer, List, List)
insteadCreate an acknowledged BulkWriteResult- Parameters:
type
- the type of the writecount
- the number of documents matchedupserts
- the list of upserts- Returns:
- an acknowledged BulkWriteResult
-
acknowledged
@Deprecated public static BulkWriteResult acknowledged(com.mongodb.internal.bulk.WriteRequest.Type type, int count, Integer modifiedCount, List<BulkWriteUpsert> upserts) Deprecated.Preferacknowledged(int, int, int, Integer, List, List)
insteadCreate an acknowledged BulkWriteResult- Parameters:
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 upserts- Returns:
- an acknowledged BulkWriteResult
-
acknowledged
public static BulkWriteResult acknowledged(com.mongodb.internal.bulk.WriteRequest.Type type, int count, Integer modifiedCount, List<BulkWriteUpsert> upserts, List<BulkWriteInsert> inserts) Create an acknowledged BulkWriteResult- Parameters:
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 upsertsinserts
- the list of inserts- Returns:
- an acknowledged BulkWriteResult
- Since:
- 4.0
-
acknowledged
@Deprecated public static BulkWriteResult acknowledged(int insertedCount, int matchedCount, int removedCount, Integer modifiedCount, List<BulkWriteUpsert> upserts) Deprecated.Preferacknowledged(int, int, int, Integer, List, List)
insteadCreate an acknowledged BulkWriteResult- Parameters:
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 not be nullupserts
- the list of upserts- Returns:
- an acknowledged BulkWriteResult
-
acknowledged
public static BulkWriteResult acknowledged(int insertedCount, int matchedCount, int removedCount, Integer modifiedCount, List<BulkWriteUpsert> upserts, List<BulkWriteInsert> inserts) Create an acknowledged BulkWriteResult- Parameters:
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 not be nullupserts
- the list of upsertsinserts
- the list of inserts- Returns:
- an acknowledged BulkWriteResult
- Since:
- 4.0
-
unacknowledged
Create an unacknowledged BulkWriteResult- Returns:
- an unacknowledged BulkWriteResult
-
acknowledged(int, int, int, Integer, List, List)
instead