Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion source/reference/command/serverStatus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4905,7 +4905,10 @@ metrics
},
"operatorCounters" : {
"expressions" : {
"<command>" : Long("0")
"<command>" : Long(<num>)
},
"match" : {
"<command>" : Long(<num>)
}
},
"queryExecutor": {
Expand Down Expand Up @@ -5031,6 +5034,37 @@ metrics

.. versionadded:: 5.0

.. serverstatus:: metrics.operatorCounters.match

A document with a number that indicates how often
:ref:`match expressions <query-projection-operators-top>` ran. For
some operators, the number reported is a multiple of the times the
operator actually ran.

:ref:`Match expression operators <query-projection-operators-top>`
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
Expand Down
14 changes: 14 additions & 0 deletions source/release-notes/5.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
<query-projection-operators-top>` ran.

.. _5.0-rel-notes-auditing:

Auditing
Expand Down