Skip to content

DOCSP-34994: socketsettings parameter types fix #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
12 changes: 10 additions & 2 deletions source/fundamentals/connection/mongoclientsettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
Specify MongoClient Settings
============================

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: java sync, customize, connection, code example

.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol


Overview
--------

Expand Down Expand Up @@ -183,7 +189,7 @@ This example demonstrates specifying a ``ConnectionString``:
MongoClient mongoClient = MongoClients.create(
MongoClientSettings.builder().applyConnectionString(new ConnectionString("mongodb+srv://<username>:<password>@<hostname>:<port>/<auth db>?connectTimeoutMS=2000"))
.applyToSocketSettings(builder ->
builder.connectTimeout(5, SECONDS))
builder.connectTimeout(5L, SECONDS))
.build());

Since the driver reads the socket settings options last, the driver
Expand Down Expand Up @@ -525,6 +531,8 @@ to modify the driver's behavior:
|
| **Default**: The operating system default

.. _java-socketsettings-example:

Example
~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions source/includes/fundamentals/code-snippets/mcs.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ private static void createSocketSettings() {
MongoClient mongoClient = MongoClients.create(
MongoClientSettings.builder().applyConnectionString(new ConnectionString("<your connection string>"))
.applyToSocketSettings(builder ->
builder.connectTimeout(10, SECONDS)
.readTimeout(15, SECONDS))
builder.connectTimeout(10L, SECONDS)
.readTimeout(15L, SECONDS))
.build());
//end SocketSettings
mongoClient.listDatabaseNames().forEach(n -> System.out.println(n));
Expand Down
31 changes: 29 additions & 2 deletions source/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
Upgrade Driver Versions
=======================

.. default-domain:: mongodb
.. facet::
:name: genre
:values: reference

.. meta::
:keywords: java sync, backwards compatibility, update

.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol


Overview
--------

Expand Down Expand Up @@ -52,6 +56,29 @@ changes between the current and upgrade versions. For example, if you
are upgrading the driver from v4.0 to v4.5, address all breaking changes from
the version after v4.0 including any listed under v4.5.

.. _java-breaking-changes-v5.0:

Version 5.0 Breaking Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- The driver removes the following record annotations:

- ``BsonId``
- ``BsonProperty``
- ``BsonRepresentation``
Comment on lines +64 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this meant to be included in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I added a note in the PR description - I think this step wasnt done when you did the ticket, so just handled it here!


- You must pass a timeout duration, which is the first parameter, to the
following ``SocketSettings`` builder methods as a ``long`` type:

- ``connectTimeout()``
- ``readTimeout()``

In earlier versions, this parameter is of type ``int`` for both methods. To view an example
that shows how to instantiate a ``SocketSettings`` instance by using
these methods, see the :ref:`SocketSettings Example
<java-socketsettings-example>` in the Specify MongoClient Settings
guide.

.. _java-breaking-changes-v4.8:

Version 4.8 Breaking Changes
Expand Down
23 changes: 13 additions & 10 deletions source/whats-new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
What's New
==========

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: java sync, backwards compatibility, update, version

.. contents:: On this page
:local:
:backlinks: none
Expand All @@ -28,21 +35,17 @@ Learn what's new in:
* :ref:`Version 4.1 <version-4.1>`
* :ref:`Version 4.0 <version-4.0>`

.. _upcoming-breaking-changes:

.. Upcoming Breaking Changes
-------------------------

.. Relocate these items into the source/upgrade.txt page once they become breaking changes

.. In addition to the deprecations mentioned in specific driver versions on this
page, anticipated breaking changes include the following:

.. _version-5.0:

What's New in 5.0
-----------------

.. warning:: Breaking Changes in v5.0

This driver version introduces breaking changes. For a list of these changes, see
the :ref:`Version 5.0 Breaking Changes section <java-breaking-changes-v5.0>` in the
Upgrade guide.

The 5.0 driver release introduces the following features:

- Consistent computation of the ``ClusterConnectionMode`` type after
Expand Down