count

open suspend override fun count(query: AdmittedQuery<CountQuery>): Long

The number of records matching query's filter. When query.query.limit is set the backend may stop counting after limit + 1 matches (count(*) over a LIMIT limit + 1 subquery, MongoDB's countDocuments limit): the core turns any count above the limit into a bounded CountResult. A null limit asks for the exact count.