kmongo / org.litote.kmongo.coroutine / CoroutineCollection / deleteMany

deleteMany

suspend fun deleteMany(filter: Bson, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Parameters

filter - the query filter to apply the the delete operation

options - the options to apply to the delete operation

Return
the DeleteResult or an com.mongodb.MongoException

Since
1.5

suspend fun deleteMany(clientSession: ClientSession, filter: Bson, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to apply the the delete operation

options - the options to apply to the delete operation

Return
the DeleteResult or an com.mongodb.MongoException

Mongodb
.server.release 3.6

Since
1.7

suspend fun deleteMany(filter: String = EMPTY_JSON, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Parameters

filter - the query filter to apply the the delete operation

options - the options to apply to the delete operation

Return
the result of the remove many operation

suspend fun deleteMany(clientSession: ClientSession, filter: String = EMPTY_JSON, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to apply the the delete operation

options - the options to apply to the delete operation

Return
the result of the remove many operation

suspend fun deleteMany(vararg filters: Bson?, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Parameters

filters - the query filters to apply the the delete operation

options - the options to apply to the delete operation

Return
the result of the remove many operation

suspend fun deleteMany(clientSession: ClientSession, vararg filters: Bson?, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

filters - the query filters to apply the the delete operation

options - the options to apply to the delete operation

Return
the result of the remove many operation