Package com.mongodb.client.result
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, thenwasAcknowledged
will return false and all other methods will throwUnsupportedOperationException
.- Since:
- 4.0
- See Also:
WriteConcern.UNACKNOWLEDGED
-
-
Constructor Summary
Constructors Constructor Description InsertManyResult()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static InsertManyResult
acknowledged(Map<Integer,BsonValue> insertedIds)
Create an acknowledged InsertManyResultabstract Map<Integer,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 InsertManyResultabstract boolean
wasAcknowledged()
Returns true if the write was acknowledged.
-
-
-
Method Detail
-
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
-
-