From 25587a1f49d4b60e2c333e7fdaab51e57d406a52 Mon Sep 17 00:00:00 2001 From: Dave Cuthbert Date: Tue, 5 Oct 2021 13:20:41 -0400 Subject: [PATCH] DOCS-14715 match expressions in serverStatus --- source/reference/command/serverStatus.txt | 36 ++++++++++++++++++++++- source/release-notes/5.1.txt | 8 ++++- 2 files changed, 42 insertions(+), 2 deletions(-) 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.1.txt b/source/release-notes/5.1.txt index 242ad6723e5..1451337e1e7 100644 --- a/source/release-notes/5.1.txt +++ b/source/release-notes/5.1.txt @@ -87,9 +87,14 @@ General Improvements :dbcommand:`serverStatus` includes the following new fields in its output: +Aggregation Metrics + - :serverstatus:`metrics.operatorCounters.match` A document which + indicates how often + :ref:`match expressions ` ran. + Resharding Statistics - :serverstatus:`shardingStatistics.resharding.lastOpEndingChunkImbalance` - + New Slot-Based Query Execution Engine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -163,3 +168,4 @@ of the related projects. :hidden: /release-notes/5.1-compatibility +