SYNOPSIS

int64_t
mongoc_collection_count (mongoc_collection_t       *collection,
                         mongoc_query_flags_t       flags,
                         const bson_t              *query,
                         int64_t                    skip,
                         int64_t                    limit,
                         const mongoc_read_prefs_t *read_prefs,
                         bson_error_t              *error);

DESCRIPTION

The mongoc_collection_count() function shall execute a count query on the underlying collection. The bson query is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

flags are the same as in mongoc_collection_find(3). query is the same as in mongoc_collection_find(3).

RETURN VALUE

The mongoc_collection_count() function returns a count of matching documents. In the event of failure it returns -1.

ERRORS

errors are returned through error

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.