@@ -4024,6 +4024,11 @@ metrics
4024
4024
"scanAndOrder" : NumberLong(<num>),
4025
4025
"writeConflicts" : NumberLong(<num>)
4026
4026
},
4027
+ "operatorCounters" : {
4028
+ "match" : {
4029
+ "<command>" : Long(<num>)
4030
+ }
4031
+ },
4027
4032
"queryExecutor": {
4028
4033
"scanned" : NumberLong(<num>),
4029
4034
"scannedObjects" : NumberLong(<num>),
@@ -4127,6 +4132,37 @@ metrics
4127
4132
4128
4133
*New in version 4.4 (4.2.6 and 4.0.19).*
4129
4134
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
+
4130
4166
.. serverstatus:: metrics.commands
4131
4167
4132
4168
A document that reports on the use of database commands. The fields
0 commit comments