@@ -3312,6 +3312,11 @@ metrics
3312
3312
"scanAndOrder" : NumberLong(<num>),
3313
3313
"writeConflicts" : NumberLong(<num>)
3314
3314
},
3315
+ "operatorCounters" : {
3316
+ "match" : {
3317
+ "<command>" : Long(<num>)
3318
+ }
3319
+ },
3315
3320
"queryExecutor": {
3316
3321
"scanned" : NumberLong(<num>),
3317
3322
"scannedObjects" : NumberLong(<num>)
@@ -3398,6 +3403,37 @@ metrics
3398
3403
3399
3404
*New in version 4.2.6 (and 4.0.19).*
3400
3405
3406
+ .. serverstatus:: metrics.operatorCounters.match
3407
+
3408
+ A document with a number that indicates how often
3409
+ :ref:`match expressions <query-projection-operators-top>` ran. For
3410
+ some operators, the number reported is a multiple of the times the
3411
+ operator actually ran.
3412
+
3413
+ :ref:`Match expression operators <query-projection-operators-top>`
3414
+ also increment as part of an aggregation pipeline :pipeline:`$match`
3415
+ stage. If the ``$match`` stage uses the :query:`$expr` operator, the
3416
+ counter for ``$expr`` increments, but the component counters do not
3417
+ increment.
3418
+
3419
+ Consider the following query:
3420
+
3421
+ .. code-block:: javascript
3422
+ :copyable: false
3423
+
3424
+ db.matchCount.aggregate(
3425
+ [
3426
+ { $match:
3427
+ { $expr: { $gt: [ "$_id", 0 ] } }
3428
+ }
3429
+ ]
3430
+ )
3431
+
3432
+ The counter for ``$expr`` increments when the query runs. The
3433
+ counter for ``$gt`` does not.
3434
+
3435
+ .. versionadded:: 4.2.18
3436
+
3401
3437
.. serverstatus:: metrics.commands
3402
3438
3403
3439
A document that reports on the use of database commands. The fields
0 commit comments