1
- =============
2
- Versioned API
3
- =============
1
+ .. _versioned-api-java:
2
+ .. _stable-api-java:
3
+
4
+ ==============
5
+ {+stable-api+}
6
+ ==============
4
7
5
8
.. default-domain:: mongodb
6
9
@@ -10,68 +13,66 @@ Versioned API
10
13
:depth: 1
11
14
:class: singlecol
12
15
13
- .. _versioned-api-java:
14
-
15
16
.. note::
16
17
17
- The Versioned API feature requires MongoDB Server 5.0 or later.
18
+ The {+stable-api+} feature requires MongoDB Server 5.0 or later.
18
19
19
- You should only use the Versioned API feature if all the MongoDB
20
+ You should only use the {+stable-api+} feature if all the MongoDB
20
21
servers you are connecting to support this feature.
21
22
22
23
Overview
23
24
--------
24
25
25
- In this guide, you can learn how to specify the **Versioned API ** when connecting to
26
- a MongoDB instance or replica set. You can use the Versioned API feature to
26
+ In this guide, you can learn how to specify the **{+stable-api+} ** when connecting to
27
+ a MongoDB instance or replica set. You can use the {+stable-api+} feature to
27
28
force the server to run operations with behavior compatible with the
28
29
specified **API version**. An API version defines the expected behavior of the
29
30
operations it covers and the format of server responses. If you change to
30
31
a different API version, the operations are not guaranteed to be
31
32
compatible and the server responses are not guaranteed to be similar.
32
33
33
- 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
34
35
can update your driver or server without worrying about backward compatibility
35
- issues of the commands covered by the Versioned API .
36
+ issues of the commands covered by the {+stable-api+} .
36
37
37
- 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/>`
38
39
for more information including a list of commands it covers.
39
40
40
- 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
41
42
your MongoDB client and the options that you can specify.
42
43
43
- Enable the Versioned API on a MongoDB Client
44
- --------------------------------------------
44
+ Enable the {+stable-api+} on a MongoDB Client
45
+ ---------------------------------------------
45
46
46
- To enable the Versioned API , you must specify an API version in the settings
47
+ To enable the {+stable-api+} , you must specify an API version in the settings
47
48
of your MongoDB client. Once you instantiate a ``MongoClient`` instance with
48
49
a specified API version, all commands you run with that client use that
49
- version of the Versioned API .
50
+ version of the {+stable-api+} .
50
51
51
52
.. tip::
52
53
53
- If you need to run commands using more than one version of the Versioned
54
- API , instantiate a separate client with that version.
54
+ If you need to run commands using more than one version of the
55
+ {+stable-api+} , instantiate a separate client with that version.
55
56
56
- 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
57
58
"strict" option is disabled. See the section on
58
- :ref:`Versioned API Options <versioned -api-options>` for more information.
59
+ :ref:`{+stable-api+} Options <stable -api-options>` for more information.
59
60
60
61
The following example shows how you can instantiate a ``MongoClient`` that
61
- sets the Versioned API version and connects to a server by performing the
62
+ sets the {+stable-api+} version and connects to a server by performing the
62
63
following operations:
63
64
64
65
- Construct a ``ServerApi`` instance using the ``ServerApi.Builder``
65
66
helper class.
66
- - Specify a Versioned API version using a constant from the
67
+ - Specify a {+stable-api+} version using a constant from the
67
68
``ServerApiVersion`` class.
68
69
- Construct a ``MongoClientSettings`` instance using the
69
70
``MongoClientSettings.Builder`` class.
70
71
- Specify a server to connect to using a ``ServerAddress`` instance.
71
72
- Instantiate a ``MongoClient`` using the ``MongoClients.create()`` method
72
73
and pass your ``MongoClientSettings`` instance as a parameter.
73
74
74
- .. literalinclude:: /includes/fundamentals/code-snippets/VersionedApiExample .java
75
+ .. literalinclude:: /includes/fundamentals/code-snippets/StableApiExample .java
75
76
:start-after: start serverAPIVersion
76
77
:end-before: end serverAPIVersion
77
78
:language: java
@@ -80,7 +81,7 @@ following operations:
80
81
.. warning::
81
82
82
83
If you specify an API version and connect to a MongoDB server that does
83
- not support the Versioned API , your application may raise an exception when
84
+ not support the {+stable-api+} , your application may raise an exception when
84
85
executing a command on your MongoDB server. If you use a ``MongoClient``
85
86
that specifies the API version to query a server that does not support it,
86
87
your query could fail with an exception message that includes the
@@ -104,11 +105,12 @@ section, see the following API Documentation:
104
105
- `MongoClient <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoClient.html>`__
105
106
106
107
.. _versioned-api-options:
108
+ .. _stable-api-options:
107
109
108
- Versioned API Options
109
- ---------------------
110
+ {+stable-api+} Options
111
+ --------------------------
110
112
111
- You can enable or disable optional behavior related to the Versioned API as
113
+ You can enable or disable optional behavior related to the {+stable-api+} as
112
114
described in the following table.
113
115
114
116
.. list-table::
@@ -132,7 +134,7 @@ described in the following table.
132
134
The following example shows how you can set the two options on an instance
133
135
of ``ServerApi`` by chaining methods on the ``ServerApi.Builder``:
134
136
135
- .. literalinclude:: /includes/fundamentals/code-snippets/VersionedApiExample .java
137
+ .. literalinclude:: /includes/fundamentals/code-snippets/StableApiExample .java
136
138
:start-after: start apiVersionOptions
137
139
:end-before: end apiVersionOptions
138
140
:language: java
0 commit comments