You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One experimental feature has been introduced while we work through the best API both for us and for the community
78
-
of other drivers. As such, it is public and we welcome feedback, but should not be considered stable and we will not make
79
-
a major version bump when/if they are changed.
69
+
## Upgrading
80
70
81
-
- A listener API to hook into events deep in the driver. Some uses of this are for logging or performance counters. We've included
82
-
a simple logging abstraction to a TextWriter as well as a PerformanceCounter implementation.
71
+
As 2.0 is a major revision, there are some breaking changes when coming from the 1.x assemblies. We've tried our best to mitigate those breaking changes, but some were inevitable. These changes may not affect everyone, but take a moment to review the list of known changes below:
83
72
84
73
85
-
Breaking Changes
86
-
================
74
+
### System Requirements
87
75
88
-
This is a major revision and we have taken the opportunity to make some necessary changes. These changes will not affect everyone. Below
89
-
are some that may affect a greater number of people:
76
+
- .NET 3.5 and .NET 4.0 are no longer supported. If you still must use these platforms, the 1.x series of the driver will continue to be developed.
77
+
-[CSHARP-952](https://jira.mongodb.org/browse/CSHARP-952): We've removed support for partially trusted callers.
90
78
91
-
- .NET 3.5 and .NET 4.0 are no longer supported. If you still must use these platforms, then the 1.x series of the driver will continue to be developed.
92
79
93
-
- The nuget package mongocsharpdriver now includes the legacy driver. It depends on 3 new nuget packages, MongoDB.Bson, MongoDB.Driver.Core,
94
-
and MongoDB.Driver. MongoDB.Driver is the replacement for mongocsharpdriver.
80
+
### Packaging
95
81
96
-
- We are no longer strong naming (CSHARP-616) our assemblies. Our previous strong naming was signed with a key in our public repository. This did
97
-
nothing other than satisfy certain tools. If you need MongoDB assemblies to be strongly named, it is relatively straight-forward to build the
98
-
assemblies yourself.
82
+
- The nuget package [mongocsharpdriver](http://nuget.org/packages/mongocsharpdriver) now includes the legacy driver. It depends on 3 new nuget packages, [MongoDB.Bson](http://nuget.org/packages/MongoDB.Bson), [MongoDB.Driver.Core](http://nuget.org/packages/MongoDB.Driver.Core), and [MongoDB.Driver](http://nuget.org/packages/MongoDB.Driver). [MongoDB.Driver](http://nuget.org/packages/MongoDB.Driver) is the replacement for [mongocsharpdriver](http://nuget.org/packages/mongocsharpdriver).
83
+
-[CSHARP-616](https://jira.mongodb.org/browse/CSHARP-616): We are no longer strong naming our assemblies. Our previous strong naming was signed with a key in our public repository. This did nothing other than satisfy certain tools. If you need MongoDB assemblies to be strongly named, it is relatively straight-forward to build the assemblies yourself.
99
84
100
-
- We've removed support for partially trusted callers (CSHARP-952).
101
85
102
-
- MongoConnectionStringBuilder (CSHARP-979) has been removed. Use the documented mongodb connection string format and/or MongoUrlBuilder.
86
+
### BSON
103
87
104
-
- MongoServer is a deprecated class. Anyone using MongoClient.GetServer() will encounter a deprecation warning and, depending on how your build is
105
-
setup, may receive an error. It is still safe to use this API until your code is ported to the new API.
88
+
-[CSHARP-933](https://jira.mongodb.org/browse/CSHARP-933): Improved the BSON Serializer infrastructure. Anyone who has written a custom serializer will be affected by this. The changes are minor, but were necessary to support dynamic serializers as well as offering great speed improvements and improved memory management.
89
+
- Certain methods, such as `BsonMemberMap.SetRepresentation` have been removed. The proper way to set a representation, for instance, would be to use `SetSerializer` and configure the serializer with the appropriate representation.
90
+
-[CSHARP-939](https://jira.mongodb.org/browse/CSHARP-939): Dynamic DictionaryRepresentation has been removed. Its intent was to store, in some manner, anything in a .NET dictionary. In practice, this leads to the same values getting stored in different ways depending on factors such as a "." inside the key name. We made the decision to eliminate this variability. This means that documents that used to serialize correctly may start throwing a BsonSerializationException with a message indicating the key must be a valid string. [CSHARP-1165](https://jira.mongodb.org/browse/CSHARP-1165) has a solution to this problem. It should be noted that we will continue to read these disparate representations without error.
106
91
107
-
- Improved the BsonSerializer infrastructure (CSHARP-933). Anyone who has written a custom serializer will be affected by this. The changes are minor,
108
-
but were necessary to support dynamic serializers as well as offering great speed improvements and improved memory management.
109
92
110
-
- ReadPreference(CSHARP-1043) and WriteConcern(CSHARP-1044) were rewritten. These classes are now immutable. Any current application
111
-
code that sets values on these classes will no longer function. Instead, you should use the With method to alter a ReadPreference or WriteConcern.
93
+
### Driver
94
+
-[CSHARP-979](https://jira.mongodb.org/browse/CSHARP-979): `MongoConnectionStringBuilder` has been removed. Use the documented mongodb connection string format and/or `MongoUrlBuilder`.
95
+
-`MongoServer` is a deprecated class. Anyone using `MongoClient.GetServer()` will encounter a deprecation warning and, depending on how your build is setup, may receive an error. It is still safe to use this API until your code is ported to the new API. *Note that this API requires the use of the [mongocsharpdriver](http://nuget.org/packages/mongocsharpdriver) to include the legacy API.
96
+
-[CSHARP-1043](https://jira.mongodb.org/browse/CSHARP-1043) and [CSHARP-1044](https://jira.mongodb.org/browse/CSHARP-1044): `ReadPreference` and `WriteConcern` were rewritten. These classes are now immutable. Any current application code that sets values on these classes will no longer function. Instead, you should use the With method to alter a `ReadPreference` or `WriteConcern`.
97
+
98
+
``` csharp
112
99
var writeConcern = myCurrentWriteConcern.With(journal: true);
113
-
114
-
- Dynamic DictionaryRepresentation (CSHARP-939) has been removed. Its intent was to store, in some manner, anything in a .NET dictionary. In practice,
115
-
this leads to the same values getting stored in different ways depending on factors such as a "." inside the key name. We made the decision to
116
-
eliminate this variability. This means that documents that used to serialize correctly may start throwing a BsonSerializationException with a message
117
-
indicating the key must be a valid string. CSHARP-1165 has a solution to this problem. It should be noted that we will continue to read these disparate
0 commit comments