Skip to content

Commit 20e5e8f

Browse files
author
Dave
authored
DOCS-14899 BACKPORT DOCS-14715 (#558)
1 parent 95ffe6e commit 20e5e8f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

source/reference/command/serverStatus.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4024,6 +4024,11 @@ metrics
40244024
"scanAndOrder" : NumberLong(<num>),
40254025
"writeConflicts" : NumberLong(<num>)
40264026
},
4027+
"operatorCounters" : {
4028+
"match" : {
4029+
"<command>" : Long(<num>)
4030+
}
4031+
},
40274032
"queryExecutor": {
40284033
"scanned" : NumberLong(<num>),
40294034
"scannedObjects" : NumberLong(<num>),
@@ -4127,6 +4132,37 @@ metrics
41274132

41284133
*New in version 4.4 (4.2.6 and 4.0.19).*
41294134

4135+
.. serverstatus:: metrics.operatorCounters.match
4136+
4137+
A document with a number that indicates how often
4138+
:ref:`match expressions <query-projection-operators-top>` ran. For
4139+
some operators, the number reported is a multiple of the times the
4140+
operator actually ran.
4141+
4142+
:ref:`Match expression operators <query-projection-operators-top>`
4143+
also increment as part of an aggregation pipeline :pipeline:`$match`
4144+
stage. If the ``$match`` stage uses the :query:`$expr` operator, the
4145+
counter for ``$expr`` increments, but the component counters do not
4146+
increment.
4147+
4148+
Consider the following query:
4149+
4150+
.. code-block:: javascript
4151+
:copyable: false
4152+
4153+
db.matchCount.aggregate(
4154+
[
4155+
{ $match:
4156+
{ $expr: { $gt: [ "$_id", 0 ] } }
4157+
}
4158+
]
4159+
)
4160+
4161+
The counter for ``$expr`` increments when the query runs. The
4162+
counter for ``$gt`` does not.
4163+
4164+
.. versionadded:: 4.4.11
4165+
41304166
.. serverstatus:: metrics.commands
41314167

41324168
A document that reports on the use of database commands. The fields

0 commit comments

Comments
 (0)