Class BulkWriteResult


  • public class BulkWriteResult
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDeletedCount()
      Returns the number of documents deleted by the write operation.
      int getInsertedCount()
      Returns the number of documents inserted by the write operation.
      java.util.List<BulkWriteInsert> getInserts()
      Gets an unmodifiable list of inserted items, or the empty list if there were none.
      int getMatchedCount()
      Returns the number of documents matched by updates or replacements in the write operation.
      int getModifiedCount()
      Returns the number of documents modified by the write operation.
      java.util.List<BulkWriteUpsert> getUpserts()
      Gets an unmodifiable list of upserted items, or the empty list if there were none.
      boolean isAcknowledged()
      Returns true if the write was acknowledged.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isAcknowledged

        public boolean isAcknowledged()
        Returns true if the write was acknowledged.
        Returns:
        true if the write was acknowledged
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getInsertedCount

        public int getInsertedCount()
        Returns the number of documents inserted by the write operation.
        Returns:
        the number of documents inserted by the write operation
        Throws:
        java.lang.UnsupportedOperationException - if the write was unacknowledged.
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getMatchedCount

        public 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:
        java.lang.UnsupportedOperationException - if the write was unacknowledged.
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getDeletedCount

        public int getDeletedCount()
        Returns the number of documents deleted by the write operation.
        Returns:
        the number of documents deleted by the write operation
        Throws:
        java.lang.UnsupportedOperationException - if the write was unacknowledged.
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getModifiedCount

        public 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:
        WriteConcern.UNACKNOWLEDGED
      • getInserts

        public java.util.List<BulkWriteInsert> 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:
        java.lang.UnsupportedOperationException - if the write was unacknowledged.
        Since:
        4.0
        See Also:
        WriteConcern.UNACKNOWLEDGED
      • getUpserts

        public java.util.List<BulkWriteUpsert> 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:
        java.lang.UnsupportedOperationException - if the write was unacknowledged.
        See Also:
        WriteConcern.UNACKNOWLEDGED