Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static MongoClient setApiVersionStrict(String connectionString) {
);

return client;
// Start Versioned API Example 2
// End Versioned API Example 2
}

private static MongoClient setApiVersionNotStrict(String connectionString) {
Expand Down
27 changes: 27 additions & 0 deletions source/reference/versioned-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ application's MongoClient:
:start-after: Start Versioned API Example 1
:end-before: End Versioned API Example 1

.. tab::
:tabid: java-sync

.. literalinclude:: /includes/driver-examples/versioned-api-java-example.java
:language: java-sync
:dedent: 4
:start-after: Start Versioned API Example 1
:end-before: End Versioned API Example 1

``"1"`` is currently the only API version available.

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

.. tab::
:tabid: java-sync

.. literalinclude:: /includes/driver-examples/versioned-api-java-example.java
:language: java-sync
:dedent: 4
:start-after: Start Versioned API Example 2
:end-before: End Versioned API Example 2

Migrate To Versioned API Commands
---------------------------------

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

.. tab::
:tabid: java-sync

.. literalinclude:: /includes/driver-examples/versioned-api-java-example.java
:language: java-sync
:dedent: 4
:start-after: Start Versioned API Example 3
:end-before: End Versioned API Example 3

Using this non-strict client allows you to run commands outside of the
Versioned API. For example, this non-strict client now allows you to
use the :dbcommand:`count` command once again.
Expand Down