Skip to content

Commit 332e6ae

Browse files
mungitoperritojeff-allen-mongo
authored andcommitted
DOCS-14715 match expressions in serverStatus
1 parent df3859a commit 332e6ae

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

source/reference/command/serverStatus.txt

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4905,7 +4905,10 @@ metrics
49054905
},
49064906
"operatorCounters" : {
49074907
"expressions" : {
4908-
"<command>" : Long("0")
4908+
"<command>" : Long(<num>)
4909+
},
4910+
"match" : {
4911+
"<command>" : Long(<num>)
49094912
}
49104913
},
49114914
"queryExecutor": {
@@ -5031,6 +5034,37 @@ metrics
50315034

50325035
.. versionadded:: 5.0
50335036

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+
50345068
.. serverstatus:: metrics.commands
50355069

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

source/release-notes/5.1.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,14 @@ General Improvements
8787
:dbcommand:`serverStatus` includes the following new fields in its
8888
output:
8989

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+
9095
Resharding Statistics
9196
- :serverstatus:`shardingStatistics.resharding.lastOpEndingChunkImbalance`
92-
97+
9398

9499
New Slot-Based Query Execution Engine
95100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -163,3 +168,4 @@ of the related projects.
163168
:hidden:
164169

165170
/release-notes/5.1-compatibility
171+

0 commit comments

Comments
 (0)