Class InsertManyResult

java.lang.Object
com.mongodb.client.result.InsertManyResult

public abstract class InsertManyResult extends 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:
  • Constructor Details

    • InsertManyResult

      public InsertManyResult()
  • Method Details

    • wasAcknowledged

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

      public abstract Map<Integer,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(Map<Integer,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