Skip to content

Commit 5255506

Browse files
authored
DOCSP-19456 adds Java Versioned API examples (#6140)
1 parent c86251c commit 5255506

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

source/includes/driver-examples/versioned-api-java-example.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static MongoClient setApiVersionStrict(String connectionString) {
2828
);
2929

3030
return client;
31-
// Start Versioned API Example 2
31+
// End Versioned API Example 2
3232
}
3333

3434
private static MongoClient setApiVersionNotStrict(String connectionString) {

source/reference/versioned-api.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ application's MongoClient:
131131
:start-after: Start Versioned API Example 1
132132
:end-before: End Versioned API Example 1
133133

134+
.. tab::
135+
:tabid: java-sync
136+
137+
.. literalinclude:: /includes/driver-examples/versioned-api-java-example.java
138+
:language: java-sync
139+
:dedent: 4
140+
:start-after: Start Versioned API Example 1
141+
:end-before: End Versioned API Example 1
142+
134143
``"1"`` is currently the only API version available.
135144

136145
By default, clients are *non-strict*. A non-strict client allows you
@@ -209,6 +218,15 @@ Use the sample code to create a *strict* client:
209218
:start-after: Start Versioned API Example 2
210219
:end-before: End Versioned API Example 2
211220

221+
.. tab::
222+
:tabid: java-sync
223+
224+
.. literalinclude:: /includes/driver-examples/versioned-api-java-example.java
225+
:language: java-sync
226+
:dedent: 4
227+
:start-after: Start Versioned API Example 2
228+
:end-before: End Versioned API Example 2
229+
212230
Migrate To Versioned API Commands
213231
---------------------------------
214232

@@ -359,6 +377,15 @@ Use the sample code to create a *non-strict* client:
359377
:start-after: Start Versioned API Example 3
360378
:end-before: End Versioned API Example 3
361379

380+
.. tab::
381+
:tabid: java-sync
382+
383+
.. literalinclude:: /includes/driver-examples/versioned-api-java-example.java
384+
:language: java-sync
385+
:dedent: 4
386+
:start-after: Start Versioned API Example 3
387+
:end-before: End Versioned API Example 3
388+
362389
Using this non-strict client allows you to run commands outside of the
363390
Versioned API. For example, this non-strict client now allows you to
364391
use the :dbcommand:`count` command once again.

0 commit comments

Comments
 (0)