Skip to content

Commit fa0f0db

Browse files
authored
Merge branch 'master' into DOCSP-45715-sealed-classes
2 parents 7244039 + c8b5575 commit fa0f0db

File tree

7 files changed

+86
-10
lines changed

7 files changed

+86
-10
lines changed

config/redirects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define: prefix docs/drivers/csharp
22
define: base https://www.mongodb.com/${prefix}
3-
define: versions v2.19 v2.20 v2.21 v2.22 v2.23 v2.24 v2.25 v2.26 v2.27 v2.28 v2.29 v2.30 v3.0 master
3+
define: versions v2.19 v2.20 v2.21 v2.22 v2.23 v2.24 v2.25 v2.26 v2.27 v2.28 v2.29 v2.30 v3.0 v3.1 master
44

55
symlink: current -> master
66

snooty.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ mdb-server = "MongoDB Server"
3232
mongo-community = "MongoDB Community Edition"
3333
mongo-enterprise = "MongoDB Enterprise Edition"
3434
docs-branch = "master" # always set this to the docs branch (i.e. master, 1.7, 1.8, etc.)
35-
version-number = "3.0"
35+
version-number = "3.1"
3636
last-version-2-number = "2.30"
3737
version = "v{+version-number+}"
3838
example = "https://raw.githubusercontent.com/mongodb/docs-csharp/{+docs-branch+}/source/includes/code-examples"

source/fundamentals/serialization/polymorphic-objects.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,19 @@ you must explicitly list each class you're looking for:
156156
.. code-block:: csharp
157157
:copyable: true
158158

159-
var query = coll.Aggregate().Match(a => a is Cat || a is Lion || a is Tiger);
159+
var query = coll.AsQueryable().Where(
160+
item => item.GetType() == typeof(Cat) ||
161+
item.GetType() == typeof(Lion) ||
162+
item.GetType() == typeof(Tiger));
163+
164+
.. note:: OfType<T>() and the is Operator
165+
166+
When checking the type of a scalar discriminator, use the ``Where`` syntax shown in
167+
the preceding code example. If you try to use the ``Aggregate().OfType<T>()`` method,
168+
or if you pass an expression containing the ``is`` operator to the
169+
``Aggregate().Match()`` method, the driver throws an exception.
170+
171+
.. _csharp-discriminator-hierarchical:
160172

161173
HierarchicalDiscriminatorConvention
162174
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/includes/language-compatibility-table-csharp.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- .NET Core 3.X
1515
- .NET Core 2.X
1616

17-
* - 3.0
17+
* - 3.0 to 3.1
1818
- ✓
1919
- ✓
2020
- ✓
@@ -45,7 +45,7 @@
4545
- .NET 4.7 [#2.14-note]_
4646
- .NET 4.6
4747

48-
* - 3.0
48+
* - 3.0 to 3.1
4949
- ✓
5050
- ✓
5151
-

source/includes/mongodb-compatibility-table-csharp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- MongoDB 3.0
1818
- MongoDB 2.6
1919

20-
* - 3.0
20+
* - 3.0 to 3.1
2121
- ✓
2222
- ✓
2323
- ✓

source/upgrade/v3.txt

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,38 @@ Version 3.0 Breaking Changes
203203
property instead.
204204

205205
- The driver removes individual cluster events from ``MongoClient.Cluster``. To listen for
206-
cluster events, use `ClusterBuilder.Subscribe() <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.Core.Configuration.ClusterBuilder.Subscribe.html>`__.
206+
cluster events, call the `ClusterBuilder.Subscribe() <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.Core.Configuration.ClusterBuilder.Subscribe.html>`__
207+
method.
208+
209+
- If any type in a collection uses a scalar discriminator, the driver throws
210+
an exception if you perform either of the following actions on the collection:
211+
212+
- Call the ``Aggregate().OfType<T>()`` method, as in the following example:
213+
214+
.. code-block:: csharp
215+
216+
collection.Aggregate().OfType<T>()
217+
218+
- Call the ``Aggregate().Match(item => item is T)`` method, as in the following example:
219+
220+
.. code-block:: csharp
221+
222+
collection.Aggregate().Match(item => item is T)
223+
224+
To use either of the preceding methods on a collection, you can apply a hierarchical
225+
discriminator to each class in the collection. See
226+
the :ref:`Polymorphic Objects <csharp-discriminator-hierarchical>`
227+
page to learn how.
228+
229+
Alternatively, you can check each item's type in a different way. For example, you
230+
can call the ``Where()`` method and pass an expression that compares the item's type
231+
to the type you're looking for, as in the following example:
232+
233+
.. code-block:: csharp
234+
235+
collection.AsQueryable().Where(item => item.GetType() == typeof(T));
236+
237+
To learn more about type discriminators, see :ref:`<csharp-polymorphism>`.
207238

208239
- The driver has sealed some types that were not designed for extension by using inheritance.
209240
This includes the following changes:
@@ -213,4 +244,4 @@ Version 3.0 Breaking Changes
213244

214245
- The driver seals the ``MongoClient``, ``MongoDatabase``, and ``MongoCollection`` classes.
215246
We recommend using the ``IMongoClient``, ``IMongoDatabase``, and ``IMongoCollection``
216-
interfaces directly.
247+
interfaces directly.

source/whats-new.txt

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ What's New
1515
:values: reference
1616

1717
.. meta::
18-
:keywords: update, new feature, deprecation, upgrade, driver v2.19, driver v2.20, driver v2.21, driver v2.22, driver v2.23, driver v2.24, driver v2.25, driver v2.26, driver v2.27, driver v2.28, driver v3.0
18+
:keywords: update, new feature, deprecation, upgrade, driver v2.22, driver v2.23, driver v2.24, driver v2.25, driver v2.26, driver v2.27, driver v2.28, driver v3.0
1919

2020
Learn what's new in:
2121

22+
* :ref:`Version 3.1 <csharp-version-3.1>`
2223
* :ref:`Version 3.0 <csharp-version-3.0>`
2324
* :ref:`Version 2.30 <csharp-version-2.30>`
2425
* :ref:`Version 2.29 <csharp-version-2.29>`
@@ -29,10 +30,42 @@ Learn what's new in:
2930
* :ref:`Version 2.24 <version-2.24>`
3031
* :ref:`Version 2.23 <version-2.23>`
3132
* :ref:`Version 2.22 <version-2.22>`
32-
* :ref:`Version 2.21 <version-2.21>`
3333

3434
.. _upcoming-breaking-changes:
3535

36+
.. _csharp-version-3.1:
37+
38+
What's New in 3.1
39+
-----------------
40+
41+
The 3.1 driver release includes the following new features:
42+
43+
- Adds new default serializers for immutable collections in the
44+
`System.Collections.Immutable <https://learn.microsoft.com/en-us/dotnet/api/system.collections.immutable?view=net-8.0>`__
45+
namespace. The driver can now serialize ``ImmutableArray`` objects, and serialization
46+
for other immutable collections is more memory efficient.
47+
48+
- Adds support for the token field type and array field expressions with Atlas Search
49+
builders for the ``equals`` operator. To learn more about using Atlas Search with the
50+
{+driver-short+}, see :ref:`csharp-atlas-search`.
51+
52+
- Adds support for sequential pagination in Atlas Search.
53+
54+
- Adds support for valid SRV hostnames with fewer than 3 parts.
55+
56+
- Adds support for the ``Exists``, ``IsMissing``, and ``IsNullOrMissing`` methods
57+
in MongoDB Query API filters.
58+
59+
- Adds support for Exact Nearest Neighbor (ENN) vector search. To learn more about ENN
60+
Vector Search, see :atlas:`Run Vector Search Queries </atlas-vector-search/vector-search-stage>`
61+
in the Atlas Search documentation.
62+
63+
- Adds support for the ``sort`` option to be passed to update commands. To learn more about
64+
using update commands with the {+driver-short+}, see :ref:`csharp-change-guide`.
65+
66+
For more information about this release, see the :github:`v3.1 release notes
67+
</mongodb/mongo-csharp-driver/releases/tag/v3.1.0>`.
68+
3669
.. _csharp-version-3.0:
3770

3871
What's New in 3.0

0 commit comments

Comments
 (0)