File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -4905,7 +4905,10 @@ metrics
4905
4905
},
4906
4906
"operatorCounters" : {
4907
4907
"expressions" : {
4908
- "<command>" : Long("0")
4908
+ "<command>" : Long(<num>)
4909
+ },
4910
+ "match" : {
4911
+ "<command>" : Long(<num>)
4909
4912
}
4910
4913
},
4911
4914
"queryExecutor": {
@@ -5031,6 +5034,37 @@ metrics
5031
5034
5032
5035
.. versionadded:: 5.0
5033
5036
5037
+ .. serverstatus:: metrics.operatorCounters.match
5038
+
5039
+ A document with a number that indicates how often
5040
+ :ref:`match expressions <query-projection-operators-top>` ran. For
5041
+ some operators, the number reported is a multiple of the times the
5042
+ operator actually ran.
5043
+
5044
+ :ref:`Match expression operators <query-projection-operators-top>`
5045
+ also increment as part of an aggregation pipeline :pipeline:`$match`
5046
+ stage. If the ``$match`` stage uses the :query:`$expr` operator, the
5047
+ counter for ``$expr`` increments, but the component counters do not
5048
+ increment.
5049
+
5050
+ Consider the following query:
5051
+
5052
+ .. code-block:: javascript
5053
+ :copyable: false
5054
+
5055
+ db.matchCount.aggregate(
5056
+ [
5057
+ { $match:
5058
+ { $expr: { $gt: [ "$_id", 0 ] } }
5059
+ }
5060
+ ]
5061
+ )
5062
+
5063
+ The counter for ``$expr`` increments when the query runs. The
5064
+ counter for ``$gt`` does not.
5065
+
5066
+ .. versionadded:: 5.1
5067
+
5034
5068
.. serverstatus:: metrics.commands
5035
5069
5036
5070
A document that reports on the use of database commands. The fields
Original file line number Diff line number Diff line change @@ -87,9 +87,14 @@ General Improvements
87
87
:dbcommand:`serverStatus` includes the following new fields in its
88
88
output:
89
89
90
+ Aggregation Metrics
91
+ - :serverstatus:`metrics.operatorCounters.match` A document which
92
+ indicates how often
93
+ :ref:`match expressions <query-projection-operators-top>` ran.
94
+
90
95
Resharding Statistics
91
96
- :serverstatus:`shardingStatistics.resharding.lastOpEndingChunkImbalance`
92
-
97
+
93
98
94
99
New Slot-Based Query Execution Engine
95
100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -163,3 +168,4 @@ of the related projects.
163
168
:hidden:
164
169
165
170
/release-notes/5.1-compatibility
171
+
You can’t perform that action at this time.
0 commit comments