============================
MongoDB\\Collection::count()
============================

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: singlecol

Definition
----------

.. phpmethod:: MongoDB\\Collection::count()

   Count the number of documents that match the filter criteria.

   .. code-block:: php

      function count($filter = [], array $options = []): integer

   This method has the following parameters:

   .. include:: /includes/apiargs/MongoDBCollection-method-count-param.rst

   The ``$options`` parameter supports the following options:

   .. include:: /includes/apiargs/MongoDBCollection-method-count-option.rst

   :returns:

      The number of documents matching the filter criteria.

.. todo: add output and examples

.. seealso::

   - :manual:`count </reference/command/count>` command reference in the MongoDB
     manual
