Interface BulkWriteResult


public interface BulkWriteResult
Result of a Bulk write execution. Exposes counts for inserted, modified, deleted, and upserted documents, and whether the operation was acknowledged by the server. Abstracts over both single-collection (BulkWriteResult) and multi-collection (ClientBulkWriteResult) driver results.
Since:
5.1
Author:
Christoph Strobl
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether the bulk write was acknowledged by the server.
    long
    Returns the number of documents deleted.
    from(com.mongodb.bulk.BulkWriteResult result)
    Creates a BulkWriteResult from a MongoDB driver BulkWriteResult.
    from(com.mongodb.client.model.bulk.ClientBulkWriteResult result)
    Creates a BulkWriteResult from a MongoDB driver ClientBulkWriteResult.
    long
    Returns the number of documents inserted.
    long
    Returns the number of documents that matched the query criteria in update, replace, or remove operations.
    long
    Returns the number of documents modified by update operations.
    long
    Returns the number of documents upserted.
  • Method Details

    • from

      static BulkWriteResult from(com.mongodb.client.model.bulk.ClientBulkWriteResult result)
      Creates a BulkWriteResult from a MongoDB driver ClientBulkWriteResult.
      Parameters:
      result - the driver result; must not be null.
      Returns:
      a new BulkWriteResult wrapping the given result.
    • from

      static BulkWriteResult from(com.mongodb.bulk.BulkWriteResult result)
      Creates a BulkWriteResult from a MongoDB driver BulkWriteResult.
      Parameters:
      result - the driver result; must not be null.
      Returns:
      a new BulkWriteResult wrapping the given result.
    • insertCount

      long insertCount()
      Returns the number of documents inserted.
      Returns:
      the insert count.
    • modifiedCount

      long modifiedCount()
      Returns the number of documents modified by update operations.
      Returns:
      the modified count.
    • deleteCount

      long deleteCount()
      Returns the number of documents deleted.
      Returns:
      the delete count.
    • upsertCount

      long upsertCount()
      Returns the number of documents upserted.
      Returns:
      the upsert count.
    • acknowledged

      boolean acknowledged()
      Returns whether the bulk write was acknowledged by the server.
      Returns:
      true if acknowledged.
    • matchedCount

      long matchedCount()
      Returns the number of documents that matched the query criteria in update, replace, or remove operations.
      Returns:
      the matched count.