Skip to content

Commit f78529d

Browse files
author
Chris Cho
authored
DOCSP-20585: versioned API renamed to stable API (#200)
* DOCSP-20585: versioned API renamed to stable API
1 parent b8a1bce commit f78529d

File tree

9 files changed

+86
-36
lines changed

9 files changed

+86
-36
lines changed

config/redirects

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ define: versions v4.3 v4.4 master
44

55
raw: ${prefix}/ -> ${base}/current/
66
raw: ${prefix}/master -> ${base}/upcoming/
7+
8+
[*-master]: ${prefix}/${version}/fundamentals/versioned-api/ -> ${prefix}/${version}/fundamentals/stable-api/

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ version = "4.4"
1212
full-version = "{+version+}.1"
1313
package-name-org = "mongodb-org"
1414
api = "https://mongodb.github.io/mongo-java-driver/{+version+}"
15+
stable-api = "Stable API"

source/fundamentals.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Fundamentals
1111
/fundamentals/connection
1212
/fundamentals/auth
1313
/fundamentals/enterprise-auth
14-
/fundamentals/versioned-api
14+
/fundamentals/stable-api
1515
/fundamentals/databases-collections
1616
/fundamentals/data-formats
1717
/fundamentals/crud

source/fundamentals/connection/mongoclientsettings.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ connection behavior:
123123
if a network error occurs.
124124

125125
* - ``serverApi()``
126-
- Sets the :ref:`server API <versioned-api-java>` to use when sending
126+
- Sets the :ref:`server API <stable-api-java>` to use when sending
127127
commands to the server.
128128

129129
* - ``streamFactoryFactory()``

source/fundamentals/versioned-api.txt renamed to source/fundamentals/stable-api.txt

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
=============
2-
Versioned API
3-
=============
1+
.. _versioned-api-java:
2+
.. _stable-api-java:
3+
4+
==============
5+
{+stable-api+}
6+
==============
47

58
.. default-domain:: mongodb
69

@@ -10,68 +13,66 @@ Versioned API
1013
:depth: 1
1114
:class: singlecol
1215

13-
.. _versioned-api-java:
14-
1516
.. note::
1617

17-
The Versioned API feature requires MongoDB Server 5.0 or later.
18+
The {+stable-api+} feature requires MongoDB Server 5.0 or later.
1819

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
2021
servers you are connecting to support this feature.
2122

2223
Overview
2324
--------
2425

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
2728
force the server to run operations with behavior compatible with the
2829
specified **API version**. An API version defines the expected behavior of the
2930
operations it covers and the format of server responses. If you change to
3031
a different API version, the operations are not guaranteed to be
3132
compatible and the server responses are not guaranteed to be similar.
3233

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
3435
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+}.
3637

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/>`
3839
for more information including a list of commands it covers.
3940

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
4142
your MongoDB client and the options that you can specify.
4243

43-
Enable the Versioned API on a MongoDB Client
44-
--------------------------------------------
44+
Enable the {+stable-api+} on a MongoDB Client
45+
---------------------------------------------
4546

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
4748
of your MongoDB client. Once you instantiate a ``MongoClient`` instance with
4849
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+}.
5051

5152
.. tip::
5253

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.
5556

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
5758
"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.
5960

6061
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
6263
following operations:
6364

6465
- Construct a ``ServerApi`` instance using the ``ServerApi.Builder``
6566
helper class.
66-
- Specify a Versioned API version using a constant from the
67+
- Specify a {+stable-api+} version using a constant from the
6768
``ServerApiVersion`` class.
6869
- Construct a ``MongoClientSettings`` instance using the
6970
``MongoClientSettings.Builder`` class.
7071
- Specify a server to connect to using a ``ServerAddress`` instance.
7172
- Instantiate a ``MongoClient`` using the ``MongoClients.create()`` method
7273
and pass your ``MongoClientSettings`` instance as a parameter.
7374

74-
.. literalinclude:: /includes/fundamentals/code-snippets/VersionedApiExample.java
75+
.. literalinclude:: /includes/fundamentals/code-snippets/StableApiExample.java
7576
:start-after: start serverAPIVersion
7677
:end-before: end serverAPIVersion
7778
:language: java
@@ -80,7 +81,7 @@ following operations:
8081
.. warning::
8182

8283
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
8485
executing a command on your MongoDB server. If you use a ``MongoClient``
8586
that specifies the API version to query a server that does not support it,
8687
your query could fail with an exception message that includes the
@@ -104,11 +105,12 @@ section, see the following API Documentation:
104105
- `MongoClient <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoClient.html>`__
105106

106107
.. _versioned-api-options:
108+
.. _stable-api-options:
107109

108-
Versioned API Options
109-
---------------------
110+
{+stable-api+} Options
111+
--------------------------
110112

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
112114
described in the following table.
113115

114116
.. list-table::
@@ -132,7 +134,7 @@ described in the following table.
132134
The following example shows how you can set the two options on an instance
133135
of ``ServerApi`` by chaining methods on the ``ServerApi.Builder``:
134136

135-
.. literalinclude:: /includes/fundamentals/code-snippets/VersionedApiExample.java
137+
.. literalinclude:: /includes/fundamentals/code-snippets/StableApiExample.java
136138
:start-after: start apiVersionOptions
137139
:end-before: end apiVersionOptions
138140
:language: java

source/includes/fundamentals-sections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Learn how to perform the following tasks using the Java driver in the
22
Fundamentals section:
33

44
- :doc:`Connect to MongoDB </fundamentals/connection>`
5-
- :doc:`Use the Versioned API </fundamentals/versioned-api>`
5+
- :doc:`Use the Stable API </fundamentals/stable-api>`
66
- :doc:`Authenticate with MongoDB </fundamentals/auth>`
77
- :doc:`Convert between MongoDB Data Formats and Java Objects </fundamentals/data-formats>`
88
- :doc:`Read from and Write to MongoDB </fundamentals/crud>`
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package fundamentals;
2+
3+
import com.mongodb.ConnectionString;
4+
import com.mongodb.MongoClientSettings;
5+
import com.mongodb.ServerApi;
6+
import com.mongodb.ServerApiVersion;
7+
import com.mongodb.client.MongoClient;
8+
import com.mongodb.client.MongoClients;
9+
10+
public class StableApiExample {
11+
private static void setApiVersionOptions(String uri) {
12+
// start apiVersionOptions
13+
ServerApi serverApi = ServerApi.builder()
14+
.version(ServerApiVersion.V1)
15+
.strict(true)
16+
.deprecationErrors(true)
17+
.build();
18+
// end apiVersionOptions
19+
}
20+
21+
public static void main(String[] args) {
22+
// start serverAPIVersion
23+
ServerApi serverApi = ServerApi.builder()
24+
.version(ServerApiVersion.V1)
25+
.build();
26+
27+
// Replace the uri string with your MongoDB deployment's connection string
28+
String uri = "<connection string uri>";
29+
30+
MongoClientSettings settings = MongoClientSettings.builder()
31+
.applyConnectionString(new ConnectionString(uri))
32+
.serverApi(serverApi)
33+
.build();
34+
35+
MongoClient client = MongoClients.create(settings);
36+
// end serverAPIVersion
37+
}
38+
}
39+

source/includes/fundamentals/code-snippets/VersionedApiExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.mongodb.client.MongoClient;
88
import com.mongodb.client.MongoClients;
99

10-
public class VersionedApiExample {
10+
public class StableApiExample {
1111
private static void setApiVersionOptions(String uri) {
1212
// start apiVersionOptions
1313
ServerApi serverApi = ServerApi.builder()
@@ -24,7 +24,7 @@ public static void main(String[] args) {
2424
.version(ServerApiVersion.V1)
2525
.build();
2626

27-
// Replace the uri string with your MongoDB deployment's connection string
27+
// Replace the placeholder with your MongoDB deployment's connection string uri
2828
String uri = "<connection string uri>";
2929

3030
MongoClientSettings settings = MongoClientSettings.builder()

source/whats-new.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ What's New in 4.3
3838

3939
New features of the 4.3 Java driver release include:
4040

41-
- Added support for MongoDB Versioned API. For more information, see our
42-
:doc:`Versioned API guide </fundamentals/versioned-api>`.
41+
- Added support for the MongoDB {+stable-api+}. For more information, see our
42+
:ref:`{+stable-api+} guide <stable-api-java>`.
43+
44+
.. note::
45+
46+
Starting from Feburary 2022, the **Versioned API** is known the **{+stable-api+}**.
47+
All concepts and features remain the same with this naming change.
48+
4349
- Added support for connection to
4450
`MongoDB Atlas Serverless Instances <https://www.mongodb.com/cloud/atlas/serverless>`__.
4551
For more information on setup, see our documentation on how to

0 commit comments

Comments
 (0)