suspend fun countDocuments(filter: Bson = EMPTY_BSON, options: CountOptions = CountOptions()): Long
(source)
Counts the number of documents in the collection according to the given options.
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
options
- the options describing the count
Since
1.9
suspend fun countDocuments(clientSession: ClientSession, filter: Bson = EMPTY_BSON, options: CountOptions = CountOptions()): Long
(source)
Counts the number of documents in the collection according to the given options.
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
clientSession
- the client session with which to associate this operation
options
- the options describing the count
Mongodb
.server.release 3.6
Since
1.9
suspend fun countDocuments(filter: String, options: CountOptions = CountOptions()): Long
(source)
Counts the number of documents in the collection according to the given options.
Return
count of filtered collection
suspend fun countDocuments(clientSession: ClientSession, filter: String, options: CountOptions = CountOptions()): Long
(source)
Counts the number of documents in the collection according to the given options.
clientSession
- the client session with which to associate this operation
options
- optional parameter, the options describing the count * @return count of filtered collection