kmongo / org.litote.kmongo / com.mongodb.client.MongoCollection / deleteOneById

deleteOneById

fun <T> MongoCollection<T>.deleteOneById(id: Any): DeleteResult (source)

Removes at most one document from the id parameter. If no documents match, the collection is not modified.

Parameters

id - the object id

Exceptions

com.mongodb.MongoWriteException - if the write failed due some other failure specific to the delete command

com.mongodb.MongoWriteConcernException - if the write failed due being unable to fulfil the write concern

com.mongodb.MongoException - if the write failed due some other failure

fun <T> MongoCollection<T>.deleteOneById(clientSession: ClientSession, id: Any): DeleteResult (source)

Removes at most one document from the id parameter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

id - the object id

Exceptions

com.mongodb.MongoWriteException - if the write failed due some other failure specific to the delete command

com.mongodb.MongoWriteConcernException - if the write failed due being unable to fulfil the write concern

com.mongodb.MongoException - if the write failed due some other failure