diff --git a/source/reference/command/serverStatus.txt b/source/reference/command/serverStatus.txt index c1d6f9beb05..a50bb7a6e9d 100644 --- a/source/reference/command/serverStatus.txt +++ b/source/reference/command/serverStatus.txt @@ -4905,7 +4905,10 @@ metrics }, "operatorCounters" : { "expressions" : { - "" : Long("0") + "" : Long() + }, + "match" : { + "" : Long() } }, "queryExecutor": { @@ -5031,6 +5034,37 @@ metrics .. versionadded:: 5.0 +.. serverstatus:: metrics.operatorCounters.match + + A document with a number that indicates how often + :ref:`match expressions ` ran. For + some operators, the number reported is a multiple of the times the + operator actually ran. + + :ref:`Match expression operators ` + also increment as part of an aggregation pipeline :pipeline:`$match` + stage. If the ``$match`` stage uses the :query:`$expr` operator, the + counter for ``$expr`` increments, but the component counters do not + increment. + + Consider the following query: + + .. code-block:: javascript + :copyable: false + + db.matchCount.aggregate( + [ + { $match: + { $expr: { $gt: [ "$_id", 0 ] } } + } + ] + ) + + The counter for ``$expr`` increments when the query runs. The + counter for ``$gt`` does not. + + .. versionadded:: 5.1 + .. serverstatus:: metrics.commands A document that reports on the use of database commands. The fields diff --git a/source/release-notes/5.0.txt b/source/release-notes/5.0.txt index 76c6a86eb5a..352228af79d 100644 --- a/source/release-notes/5.0.txt +++ b/source/release-notes/5.0.txt @@ -237,6 +237,20 @@ collections. See :ref:`lookup-uncorrelated-subquery`. +Aggregation Metrics +``````````````````` + +.. list-table:: + :header-rows: 1 + :widths: 20 80 + + * - Metric + - Description + + * - :serverstatus:`metrics.operatorCounters.match` + - A document which indicates how often :ref:`match expressions + ` ran. + .. _5.0-rel-notes-auditing: Auditing