Package com.mongodb.client.result
Class InsertOneResult
java.lang.Object
com.mongodb.client.result.InsertOneResult
The result of an insert one operation. If the insert one was unacknowledged, then
wasAcknowledged
will
return false and all other methods will throw UnsupportedOperationException
.- Since:
- 4.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic InsertOneResult
acknowledged
(BsonValue insertId) Create an acknowledged InsertOneResultabstract BsonValue
If the _id of the inserted document if available, otherwise nullstatic InsertOneResult
Create an unacknowledged InsertOneResultabstract boolean
Returns true if the write was acknowledged.
-
Constructor Details
-
InsertOneResult
public InsertOneResult()
-
-
Method Details
-
wasAcknowledged
public abstract boolean wasAcknowledged()Returns true if the write was acknowledged.- Returns:
- true if the write was acknowledged
-
getInsertedId
If the _id of the inserted document if available, otherwise nullNote: Inserting RawBsonDocuments does not generate an _id value.
- Returns:
- if _id of the inserted document if available, otherwise null
-
acknowledged
Create an acknowledged InsertOneResult- Parameters:
insertId
- the id of the inserted document- Returns:
- an acknowledged InsertOneResult
-
unacknowledged
Create an unacknowledged InsertOneResult- Returns:
- an unacknowledged InsertOneResult
-