Skip to content

Commit 517ac4f

Browse files
authored
DOCSP-39859: What's New 3.0 (#122)
1 parent 108a9b8 commit 517ac4f

File tree

2 files changed

+73
-12
lines changed

2 files changed

+73
-12
lines changed

source/fundamentals/runtimes.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@ and structure your code to use each.
2020
The {+driver-short+} supports the ``tokio`` asynchronous runtime crate, which is the default
2121
runtime.
2222

23-
.. important::
24-
25-
Beginning in {+driver-short+} v3.0, the ``tokio`` runtime is the only asynchronous runtime crate that
26-
the driver supports. Previous versions of the driver also support the ``async-std`` runtime crate.
27-
If your application uses the ``async-std`` runtime, you can start a ``tokio`` runtime in the same
28-
application by creating a ``Runtime`` struct instance and wrapping driver operations with the ``Runtime::spawn()``
29-
method. Ensure that you use the same ``Runtime`` instance for instantiating a ``Client`` and calling
30-
driver methods on that ``Client`` instance.
31-
32-
For an example that instantiates a ``Runtime`` and calls the ``spawn()`` method, see the `tokio documentation
33-
<https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#examples-2>`__.
34-
3523
The driver also includes a synchronous API for use cases that require blocking, or when parallelism
3624
is not necessary. You can select the synchronous API by adding feature flags to the ``mongodb`` dependency
3725
in your ``Cargo.toml`` file.
@@ -63,6 +51,19 @@ the ``mongodb`` dependency. For more information on installing the driver and ad
6351
including an example that specifies the ``"tokio-runtime"`` feature flag, see the
6452
:ref:`rust-quick-start-download-and-install` step of the Quick Start.
6553

54+
.. important::
55+
56+
Beginning in {+driver-short+} v3.0, the ``tokio`` runtime is the only asynchronous runtime crate that
57+
the driver supports. Previous versions of the driver also support the ``async-std`` runtime crate.
58+
59+
If your application uses the ``async-std`` runtime, you can start a ``tokio`` runtime in the same
60+
application by creating a ``Runtime`` struct instance and wrapping driver operations with the ``Runtime::spawn()``
61+
method. Ensure that you use the same ``Runtime`` instance for instantiating a ``Client`` and calling
62+
driver methods on that ``Client`` instance.
63+
64+
For an example that instantiates a ``Runtime`` and calls the ``spawn()`` method, see the `tokio documentation
65+
<https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#examples-2>`__.
66+
6667
Tokio Runtime Example
6768
~~~~~~~~~~~~~~~~~~~~~
6869

source/whats-new.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,70 @@ What's New
2020
Learn about new features, improvements, and fixes introduced in the
2121
following versions of the {+driver-long+}:
2222

23+
* :ref:`Version 3.0 <rust-version-3.0>`
2324
* :ref:`Version 2.8 <rust-version-2.8>`
2425
* :ref:`Version 2.7 <rust-version-2.7>`
2526
* :ref:`Version 2.6 <rust-version-2.6>`
2627

28+
.. _rust-version-3.0:
29+
30+
What's New in 3.0
31+
-----------------
32+
33+
The {+driver-short+} v3.0 release includes the following features, improvements, and fixes:
34+
35+
- Implements a fluent API, which introduces the following syntax changes for passing options and
36+
starting sessions:
37+
38+
- To set asynchronous method options, chain option builder methods directly to the method call
39+
instead of passing an options struct parameter.
40+
41+
- To set synchronous method options, chain option builder methods to the method call, then
42+
call the ``run()`` method.
43+
44+
- If you must construct a separate options struct, chain the ``with_options()``
45+
method to the method call and pass your options struct as a parameter.
46+
47+
- To start a session, chain the ``session()`` method to the method call instead of using a separate
48+
method that has a ``_with_session`` suffix.
49+
50+
- Adds support for bulk write operations. To learn more about these operations, see the
51+
:ref:`rust-bulk-guide` guide.
52+
53+
- Introduces the ``EventHandler`` type to reduce the amount of boilerplate code required for event monitoring.
54+
For examples that use the ``EventHandler`` type, see the :ref:`rust-monitoring` guides.
55+
56+
- Removes support for the ``async-std`` asynchronous runtime. To learn more about this change, see
57+
the :ref:`rust-runtimes-configure-async` section of the Asynchronous and Synchronous APIs guide.
58+
59+
- Requires the use of a ``compat`` feature if a {+driver-short+} application is compiled with
60+
the ``no-default-features`` command line flag. The ``rustls`` and ``dns-resolution`` features
61+
are now optional.
62+
63+
- Removes support for the ``bson-*`` driver features. You can select these features by including
64+
``bson`` as a direct dependency in your application.
65+
66+
- Removes support for read and write concern constants. Instead, use helper methods to set ``ReadConcern`` and
67+
``WriteConcern`` values.
68+
69+
- Adds ``Send + Sync`` constraints to the ``Collection<T>`` type.
70+
71+
- Removes the ``ClientOptions::compressor`` field if no compressor features are enabled.
72+
73+
- Changes the type of ``ReadPreferenceOptions`` fields. These fields now have a ``Option<ReadPreferenceOptions>`` type.
74+
75+
- Removes the ``CollectionOptions::human_readable_serialization`` option. Instead, use the ``bson::HumanReadable``
76+
wrapper type to serialize user data into human-readable form.
77+
78+
- Adds support for value conversion through the ``Into`` trait for all option struct builders.
79+
80+
- Renames the ``comment_bson`` field to ``comment`` for ``AggregateOptions``, ``FindOptions``, and ``FindOneOptions``
81+
structs.
82+
83+
To learn more about this release, see the `v3.0 Migration Guide
84+
<https://github.com/mongodb/mongo-rust-driver/blob/main/migration-3.0.md>`__
85+
on GitHub.
86+
2787
.. _rust-version-2.8:
2888

2989
What's New in 2.8

0 commit comments

Comments
 (0)