deleteMany

abstract suspend fun deleteMany(filter: Bson): DeleteResult

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

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException

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

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

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException

abstract suspend fun deleteMany(clientSession: ClientSession, filter: Bson): DeleteResult

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

Since

3.6

Parameters

clientSession

the client session with which to associate this operation

filter

the query filter to apply the the delete operation

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException

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

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

Since

3.6

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

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException