1
- =============
2
- Versioned API
3
- =============
1
+ .. _nodejs-stable-api:
2
+
3
+ ==============
4
+ {+stable-api+}
5
+ ==============
4
6
5
7
.. default-domain:: mongodb
6
8
@@ -12,60 +14,62 @@ Versioned API
12
14
13
15
.. note::
14
16
15
- The Versioned API feature requires MongoDB Server 5.0 or later.
17
+ The {+stable-api+} feature requires MongoDB Server 5.0 or later.
16
18
17
- You should only use the Versioned API feature if all the MongoDB
19
+ You should only use the {+stable-api+} feature if all the MongoDB
18
20
servers you are connecting to support this feature.
19
21
20
22
Overview
21
23
--------
22
24
23
- In this guide, you can learn how to specify the **Versioned API** when connecting to
24
- a MongoDB instance or replica set. You can use the Versioned API feature to
25
- force the server to run operations with behavior compatible with the
26
- specified **API version**. An API version defines the expected behavior of the
27
- operations it covers and the format of server responses. If you change to
28
- a different API version, the operations are not guaranteed to be
29
- compatible and the server responses are not guaranteed to be similar.
25
+ In this guide, you can learn how to specify the **{+stable-api+}** when
26
+ connecting to a MongoDB instance or replica set. You can use the
27
+ {+stable-api+} feature to force the server to run operations with behavior
28
+ compatible with the specified **API version**. An API version defines the
29
+ expected behavior of the operations it covers and the format of server
30
+ responses. If you change to a different API version, the operations are not
31
+ guaranteed to be compatible and the server responses are not guaranteed to
32
+ be similar.
30
33
31
- When you use the Versioned API feature with an official MongoDB driver, you
34
+ When you use the {+stable-api+} feature with an official MongoDB driver, you
32
35
can update your driver or server without worrying about backward compatibility
33
- issues of the commands covered by the Versioned API .
36
+ issues of the commands covered by the {+stable-api+} .
34
37
35
- See the server manual page on the `Versioned API <https://docs.mongodb.com/v5.0/ reference/versioned -api/>`__
38
+ See the MongoDB reference page on the :manual:`{+stable-api+} </ reference/stable -api/>`
36
39
for more information including a list of commands it covers.
37
40
38
- The following sections describe how you can enable the Versioned API for
41
+ The following sections describe how you can enable the {+stable-api+} for
39
42
your MongoDB client and the options that you can specify.
40
43
41
- Enable the Versioned API on a MongoDB Client
42
- --------------------------------------------
44
+ Enable the {+stable-api+} on a MongoDB Client
45
+ ---------------------------------------------
43
46
44
- To enable the Versioned API , you must specify an API version in the ``MongoClientOptions``
47
+ To enable the {+stable-api+} , you must specify an API version in the ``MongoClientOptions``
45
48
passed to your ``MongoClient``. Once you instantiate a ``MongoClient`` instance with
46
49
a specified API version, all commands you run with that client use that
47
- version of the Versioned API .
50
+ version of the {+stable-api+} .
48
51
49
52
.. tip::
50
53
51
54
If you need to run commands using more than one version of the Versioned
52
55
API, instantiate a separate client with that version.
53
56
54
- If you need to run commands not covered by the Versioned API , make sure the
57
+ If you need to run commands not covered by the {+stable-api+} , make sure the
55
58
"strict" option is disabled. See the section on
56
- :ref:`Versioned API Options <versioned-api-options>` for more information.
59
+ :ref:`{+stable-api+} Options <nodejs-stable-api-options>` for more
60
+ information.
57
61
58
62
The example below shows how you can instantiate a ``MongoClient`` that
59
- sets the Versioned API version and connects to a server by performing the
63
+ sets the {+stable-api+} version and connects to a server by performing the
60
64
following operations:
61
65
62
66
- Specify a server URI to connect to.
63
- - Specify a Versioned API version in the ``MongoClientOptions`` object, using a
67
+ - Specify a {+stable-api+} version in the ``MongoClientOptions`` object, using a
64
68
constant from the ``ServerApiVersion`` object.
65
69
- Instantiate a ``MongoClient``, passing the URI and the ``MongoClientOptions``
66
70
to the constructor.
67
71
68
- .. literalinclude:: /code-snippets/versioned -api/basic.js
72
+ .. literalinclude:: /code-snippets/stable -api/basic.js
69
73
:start-after: begin serverApiVersion
70
74
:end-before: end serverApiVersion
71
75
:language: javascript
@@ -74,7 +78,7 @@ following operations:
74
78
.. warning::
75
79
76
80
If you specify an API version and connect to a MongoDB server that does
77
- not support the Versioned API , your application may throw an error when
81
+ not support the {+stable-api+} , your application may throw an error when
78
82
connecting to your MongoDB server with the following text:
79
83
80
84
.. code-block:: none
@@ -89,12 +93,13 @@ section, see the following API Documentation:
89
93
- `MongoClientOptions <{+api+}/interfaces/MongoClientOptions.html>`__
90
94
- `MongoClient <{+api+}/classes/MongoClient.html>`__
91
95
96
+ .. _nodejs-stable-api-options:
92
97
.. _versioned-api-options:
93
98
94
- Versioned API Options
95
- ---------------------
99
+ {+stable-api+} Options
100
+ ----------------------
96
101
97
- You can enable or disable optional behavior related to the Versioned API as
102
+ You can enable or disable optional behavior related to the {+stable-api+} as
98
103
described in the following table.
99
104
100
105
.. list-table::
@@ -106,7 +111,7 @@ described in the following table.
106
111
- Description
107
112
108
113
* - version
109
- - | **Required**. Specifies the version of the Versioned API .
114
+ - | **Required**. Specifies the version of the {+stable-api+} .
110
115
|
111
116
| Default: **null**
112
117
@@ -125,7 +130,7 @@ described in the following table.
125
130
The following example shows how you can set the options of the ``ServerApi``
126
131
interface.
127
132
128
- .. literalinclude:: /code-snippets/versioned -api/options.js
133
+ .. literalinclude:: /code-snippets/stable -api/options.js
129
134
:start-after: begin serverApiVersion
130
135
:end-before: end serverApiVersion
131
136
:language: javascript
0 commit comments