Package com.mongodb.client.result
Class InsertManyResult
java.lang.Object
com.mongodb.client.result.InsertManyResult
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InsertManyResultacknowledged(Map<Integer, BsonValue> insertedIds) Create an acknowledged InsertManyResultAn unmodifiable map of the index of the inserted document to the id of the inserted document.static InsertManyResultCreate an unacknowledged InsertManyResultabstract booleanReturns true if the write was acknowledged.
-
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
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
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
Create an unacknowledged InsertManyResult- Returns:
- an unacknowledged InsertManyResult
-