Class InsertManyResult


  • public abstract class InsertManyResult
    extends java.lang.Object
    The result of an insert many operation. If the insert many was unacknowledged, then wasAcknowledged will return false and all other methods will throw UnsupportedOperationException.
    Since:
    4.0
    See Also:
    WriteConcern.UNACKNOWLEDGED
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static InsertManyResult acknowledged​(java.util.Map<java.lang.Integer,​org.bson.BsonValue> insertedIds)
      Create an acknowledged InsertManyResult
      abstract java.util.Map<java.lang.Integer,​org.bson.BsonValue> getInsertedIds()
      An unmodifiable map of the index of the inserted document to the id of the inserted document.
      static InsertManyResult unacknowledged()
      Create an unacknowledged InsertManyResult
      abstract boolean wasAcknowledged()
      Returns true if the write was acknowledged.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InsertManyResult

        public InsertManyResult()
    • Method Detail

      • wasAcknowledged

        public abstract boolean wasAcknowledged()
        Returns true if the write was acknowledged.
        Returns:
        true if the write was acknowledged
      • getInsertedIds

        public abstract java.util.Map<java.lang.Integer,​org.bson.BsonValue> getInsertedIds()
        An unmodifiable map of the index of the inserted document to the id of the inserted document.

        Note: Inserting RawBsonDocuments does not generate an _id value and it's corresponding value will be null.

        Returns:
        A map of the index of the inserted document to the id of the inserted document.
      • acknowledged

        public static InsertManyResult acknowledged​(java.util.Map<java.lang.Integer,​org.bson.BsonValue> insertedIds)
        Create an acknowledged InsertManyResult
        Parameters:
        insertedIds - the map of the index of the inserted document to the id of the inserted document.
        Returns:
        an acknowledged InsertManyResult
      • unacknowledged

        public static InsertManyResult unacknowledged()
        Create an unacknowledged InsertManyResult
        Returns:
        an unacknowledged InsertManyResult