Skip to content

DOCS-14715 match expressions in serverStatus #5978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion source/reference/command/serverStatus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4905,7 +4905,10 @@ metrics
},
"operatorCounters" : {
"expressions" : {
"<command>" : Long("0")
"<command>" : Long(<num>)
},
"match" : {
"<command>" : Long(<num>)
}
},
"queryExecutor": {
Expand Down Expand Up @@ -5031,6 +5034,37 @@ metrics

.. versionadded:: 5.0

.. serverstatus:: metrics.operatorCounters.match

A document with a number that indicates how often
:ref:`match expressions <query-projection-operators-top>` ran. For
some operators, the number reported is a multiple of the times the
operator actually ran.

:ref:`Match expression operators <query-projection-operators-top>`
also increment as part of an aggregation pipeline :pipeline:`$match`
stage. If the ``$match`` stage uses the :query:`$expr` operator, the
counter for ``$expr`` increments, but the component counters do not
increment.

Consider the following query:

.. code-block:: javascript
:copyable: false

db.matchCount.aggregate(
[
{ $match:
{ $expr: { $gt: [ "$_id", 0 ] } }
}
]
)

The counter for ``$expr`` increments when the query runs. The
counter for ``$gt`` does not.

.. versionadded:: 5.1

.. serverstatus:: metrics.commands

A document that reports on the use of database commands. The fields
Expand Down
8 changes: 7 additions & 1 deletion source/release-notes/5.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,14 @@ General Improvements
:dbcommand:`serverStatus` includes the following new fields in its
output:

Aggregation Metrics
- :serverstatus:`metrics.operatorCounters.match` A document which
indicates how often
:ref:`match expressions <query-projection-operators-top>` ran.

Resharding Statistics
- :serverstatus:`shardingStatistics.resharding.lastOpEndingChunkImbalance`


New Slot-Based Query Execution Engine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -163,3 +168,4 @@ of the related projects.
:hidden:

/release-notes/5.1-compatibility