Skip to content

Commit 5b58093

Browse files
authored
DOCS-15016 add apiversion to serverStatus (#443)
* DOCS-15016 add apiversion to serverStatus * add code block to versioned-api.txt * remove quotes * remove reference to 4.7 * Add placeholder comments * Add context * verb tense update * populates -> appears * xuerui comments #1 * command -> metric * monospace appname on versioned-api.txt * a -> for a
1 parent 10cc64e commit 5b58093

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

source/reference/command/serverStatus.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4878,6 +4878,11 @@ metrics
48784878
.. code-block:: javascript
48794879

48804880
"metrics" : {
4881+
"apiVersions": {
4882+
"<appName1>": <string>,
4883+
"<appName2>": <string>,
4884+
"<appName3>": <string>
4885+
},
48814886
"aggStageCounters" : {
48824887
"<aggregation stage>" : NumberLong(<num>)
48834888
},
@@ -5054,6 +5059,36 @@ metrics
50545059

50555060
*New in version 4.4 (4.2.6 and 4.0.19).*
50565061

5062+
.. _server-status-apiVersions:
5063+
5064+
.. serverstatus:: metrics.apiVersions
5065+
5066+
A document with client applications and the version of Stable
5067+
API which they are configured with. Consider the following when
5068+
viewing ``metrics.apiVersions``:
5069+
5070+
- The only possible returned values for each ``appname`` are
5071+
``default`` or ``1``.
5072+
5073+
- API version metrics are retained for 24 hours. If
5074+
no commands are issued with a specific API version from an
5075+
application in the past 24 hours, that ``appname`` and API version
5076+
will be removed from the metrics. This also applies to the
5077+
``default`` API version metric.
5078+
5079+
- Set the ``appname`` when connecting to a MongoDB instance by
5080+
specifying the ``appname`` in the connection URI. ``?appName=ZZZ``
5081+
sets the ``appname`` to ``ZZZZ``.
5082+
5083+
- Drivers accessing the Stable API can set a default ``appname``.
5084+
5085+
- If no ``appname`` is configured, a default value will be
5086+
automatically populated based on the product. For example, for a
5087+
:compass:`MongoDB Compass </>` connection with no ``appname`` in
5088+
the URI, the metric returns: ``'MongoDB Compass': [ 'default' ]``.
5089+
5090+
*New in version 5.0.*
5091+
50575092
.. serverstatus:: metrics.operatorCounters
50585093

50595094
A document with a number that indicates how often

source/reference/stable-api.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,21 @@ By default, clients are *non-strict*. A non-strict client allows you
206206
to run any command, regardless of whether or not it belongs to the
207207
Stable API.
208208

209+
Checking Client API Versions
210+
----------------------------
211+
212+
Use the :dbcommand:`serverStatus` command to check for your
213+
application's configured API version. For each application connected to
214+
your MongoDB instance, an ``appname`` appears in the ``apiVersions``
215+
document.
216+
217+
See :ref:`metrics.apiVersions <server-status-apiVersions>` for more
218+
information.
219+
220+
.. code-block:: javascript
221+
222+
db.runCommand( { serverStatus: 1 } ).metrics.apiVersions
223+
209224
Create a Strict Client
210225
----------------------
211226

source/release-notes/5.0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,9 @@ Aggregation Metrics
989989
- :serverstatus:`metrics.dotsAndDollarsFields`
990990
- :serverstatus:`metrics.operatorCounters`
991991

992+
API Version Metrics
993+
- :serverstatus:`metrics.apiVersions`
994+
992995
Replication Metrics
993996
- :serverstatus:`metrics.repl.reconfig.numAutoReconfigsForRemovalOfNewlyAddedFields`
994997

0 commit comments

Comments
 (0)