CSHARP-5996: Remove obsolete APIs - #2091
Open
adelinowona wants to merge 10 commits into
Open
Conversation
Removes the obsolete public API that had no remaining references anywhere in src/ or tests/, so no call sites needed rework: - Feature: 30 obsolete server-version features plus the HintForFindAndModifyFeature property. Each was supported by every server version this driver supports, or covered a feature the server removed in 4.2. HintForFindAndModifyOperations is the live replacement for the latter. - HintForFindAndModifyFeature, SemaphoreSlimRequest, PriorityServerSelector: public types with no references. DeprioritizedServersServerSelector is the live replacement for PriorityServerSelector. - MongoConnectionException.ContainsSocketTimeoutException: superseded by ContainsTimeoutException. - CreateCollectionOptions.NoPadding and UsePowerOf2Sizes: both options were removed in server 4.2, and the properties only wrote backing fields that nothing read, so neither ever reached the wire. - ChangeStreamDocument.DisambiguatedPaths: already returned null; ChangeStreamUpdateDescription.DisambiguatedPaths carries the value. Csfle2QEv2TextPreviewAlgorithm is left in place: its StringPreview replacement only shipped in 3.10.0, so the deprecation window is still open. Removing public API is a breaking change and targets the 4.0 major release.
… event APIs GeoHaystack index support: the GeoHaystack builders on IndexKeysDefinitionBuilder and its extensions, the internal GeoHaystackIndexKeyDefinition, and the BucketSize option on both CreateIndexOptions and CreateIndexRequest (including the "bucketSize" field it rendered into the createIndexes command). Note this one does drop working functionality rather than dead code. The driver's minimum server version is 4.4, geoHaystack was deprecated in 4.4, and the server removed it in 5.0 — so it still works against 4.4, the oldest server this driver supports, and fails on everything newer. IMongoIndexManager.CreateOne / CreateOneAsync overloads taking an IndexKeysDefinition plus CreateIndexOptions, and their MongoIndexManagerBase implementations. The CreateIndexModel overloads cover the same ground; nothing in the driver or its tests called the removed overloads. The multi-message constructors and RequestIds properties on ConnectionSendingMessagesEvent, ConnectionSendingMessagesFailedEvent and ConnectionSentMessagesEvent. Sending multiple messages per event was already gone, so these only ever wrapped a single request id. Drops the now-unused System.Collections.Generic and System.Linq imports from all three. Removing public API is a breaking change and targets the 4.0 major release.
Removes the map-reduce surface in full. Aggregation pipelines are the replacement, as the obsolete messages have said since the API was deprecated. Public API: - IMongoCollection<TDocument>.MapReduce / MapReduceAsync (4 overloads) and their implementations in MongoCollectionBase, MongoCollectionImpl and FilteredMongoCollectionBase. - MapReduceOptions<TDocument, TResult> and MapReduceOutputOptions, including the Merge / Reduce / Replace factory methods and the NonAtomic, Sharded and JavaScriptMode options the server had already stopped honouring. Internals: MapReduceOperation<TResult>, MapReduceOperationBase, MapReduceOutputToCollectionOperation, MapReduceOutputMode, and the three private helpers in MongoCollectionImpl that built them. Tests: the three operation test classes, JsonDrivenMapReduceTest, UnifiedMapReduceOperation, their two factory registrations, and the map-reduce cases in MongoCollectionImplTests and OfTypeMongoCollectionTests. No spec JSON referenced mapReduce, so no fixtures needed changing. Also drops the "out" special case in CommandStartedEventAsserter, which existed only to accept map-reduce's short-form output field. The switch it lived in has no default label, so a mismatch on "out" already fell through to the same assertion failure that now handles it. Removing public API is a breaking change and targets the 4.0 major release.
Removes the deprecated count helpers in favour of CountDocuments and EstimatedDocumentCount: - IMongoCollection<TDocument>.Count / CountAsync and their implementations in MongoCollectionBase, MongoCollectionImpl and FilteredMongoCollectionBase. - The Count / CountAsync expression overloads on IMongoCollectionExtensions. - IFindFluent<TDocument, TProjection>.Count / CountAsync and the FindFluentBase and FindFluent implementations. - MongoCollectionImpl.CreateCountOperation, orphaned by the above. CountOperation itself stays: EstimatedDocumentCountOperation builds one, so the count command is still sent and still covered. Test changes: - CausalConsistencyTests and PlainAuthenticationTests used Count only as a convenient read; both now use CountDocuments. The causal-consistency event captures move from the count command to aggregate accordingly. - OfTypeMongoCollectionTests' two derived-type counting tests assert discriminator filtering rather than the Count API, so they move to CountDocuments and are renamed to match. - Deletes the tests that only exercised the removed API, along with JsonDrivenCountTest and UnifiedCountOperation. - Both spec-test factories now skip the "count" operation with a reason. The spec suites still drive it in 44 places, and every one of those paths is also covered by countDocuments or estimatedDocumentCount, so no unique conformance coverage is lost. The spec's own test names call these cases "Deprecated count". Also fixes an error in the preceding MapReduce commit, which claimed no spec fixtures referenced mapReduce and deleted its factory registrations outright. The fixtures live in the repo-root specifications/ tree, not under tests/, so the earlier search missed four files and left six retryable-reads cases failing with "Invalid method name: 'mapReduce'". Both factories now skip mapReduce the same way count is skipped. Removing public API is a breaking change and targets the 4.0 major release.
Clears the scattered obsolete members that had no cluster of their own. 29 members across the Bson, Driver and Encryption assemblies: - AggregateOptions.UseCursor and AggregateOperation.UseCursor, along with the backing fields and the two call sites that copied one into the other. Server 3.6 and newer always use a cursor. - ConnectionId.LocalValue / ServerValue, superseded by LongLocalValue and LongServerValue. - ConnectionDescription.ServerVersion and ServerDescription.Version. MaxWireVersion is the supported way to ask what a server can do. - Server.Invalidate(string), replaced by the overload taking a TopologyDescription. - BulkWriteInsertOneResult.InsertedId, superseded by DocumentId. - MongoCredential.Password, superseded by Evidence. PasswordEvidence.ToInsecureString covers the two test call sites. - PipelineDefinition.Serializer, superseded by OutputSerializer. - The two-argument RenderedFieldDefinition constructor. - IAggregateFluent.Unwind and its extension overload that took a serializer instead of AggregateUnwindOptions. - The two BatchableSource constructors taking a bare IEnumerable / IEnumerator. - MessageEncoderSettingsName.GuidRepresentation. - The ServerHeartbeatFailedEvent constructor without a duration. - IServerSession.AdvanceTransactionNumber / WasUsed and their ServerSession implementations. The ICoreServerSession members of the same name are unaffected. - IMongoCollection.InsertOneAsync(TDocument, CancellationToken). - GridFSFileInfo.IdAsBsonValue. Note the "IdAsBsonValue" string stays: it is the registered serializer member name that the live Id property reads _id through. - BsonDocument(params BsonElement[]). - ClientEncryption.CreateEncryptedCollection / Async overloads taking DataKeyOptions rather than a masterKey, plus the tests for validation that only existed on them. - DatabaseNamespace.SystemIndexesCollection / SystemNamespacesCollection, already internal and gone from the server in 4.2. Test-side notes: tests that only exercised a removed member are deleted; tests where the member was incidental are migrated. The libmongocrypt smoke test compared ServerDescription.Version against a semantic version to gate a SERVER-106469 workaround; it now compares MaxWireVersion, spelled out as a constant because WireVersion is internal and that project only sees the public surface. Removing public API is a breaking change and targets the 4.0 major release.
Removes the eight SSL-named properties that were thin aliases over the TLS fields: - ConnectionString.Ssl and SslVerifyCertificate (use Tls and TlsInsecure) - MongoUrl.UseSsl and VerifySslCertificate - MongoUrlBuilder.UseSsl and VerifySslCertificate - MongoClientSettings.UseSsl and VerifySslCertificate (use UseTls and AllowInsecureTls) Each read or wrote the same backing field as the TLS-named property declared immediately beside it, so no behaviour is defined by these members. Connection string parsing is deliberately untouched. The ssl and sslVerifyCertificate keywords still parse exactly as before: their handlers write _tls and _tlsInsecure, which the non-obsolete Tls and TlsInsecure properties expose. The ssl keyword is required by the URI options spec and shares a case with tls. No connection string that worked before behaves differently. Tests are migrated rather than dropped wherever they carried coverage the TLS-named properties did not already have: - ConnectionStringTests' ssl and sslVerifyCertificate keyword tests now assert through Tls and TlsInsecure, keeping the proof that both keywords are honoured. Note sslVerifyCertificate is the inverse of tlsInsecure. - The connection-string spec runner's "ssl" case asserts against Tls, so the spec fixtures still verify the option. - MongoClientSettingsTests' defaults and clone-equality tests had no AllowInsecureTls coverage, so their VerifySslCertificate assertions were converted rather than deleted. - TestUseSsl and TestVerifySslCertificate are deleted: TestUseTls and TestAllowInsecureTls already cover the same ground, including the SslSettings.CheckCertificateRevocation side effect. WaitQueueSize, WaitQueueMultiple and ComputedWaitQueueSize are left in place. They have no replacement to migrate to and need their own investigation. Removing public API is a breaking change and targets the 4.0 major release.
Csfle2QEv2StringPreviewAlgorithm replaced it in CSHARP-5984 and both name the same wire version, so the two were interchangeable. The earlier "Remove unreferenced obsolete APIs" commit left this one in place because the replacement had only shipped in 3.10.0. That reasoning applies to a minor release; this work targets 4.0, where the deprecation window is not a constraint. Nothing in src/ or tests/ referenced it. Csfle2QEv2StringPreviewAlgorithm and Csfle2QEv2StringAlgorithm are unaffected. Removing public API is a breaking change and targets the 4.0 major release.
StringOptions and EncryptionAlgorithm.String replaced these in CSHARP-5984. Both removed members were pure aliases: - TextOptions carried no behaviour of its own. Its CreateDocument extension and StringOptions' both delegated to CreateStringOptionsDocument with the same five fields, so the two produced identical BSON, and EnsureThatOptionsAreValid applied the same rules to each. - EncryptionAlgorithm.TextPreview was translated to "String" by ConvertEnumAlgorithmToString before reaching the wire. Preview versus GA is expressed by the query type, not by the options type or the algorithm: ValidStringQueryTypes accepts prefix, prefixPreview, substring, substringPreview, suffix and suffixPreview, and StringOptions has always accepted all six. A caller on server 8.2 pairs StringOptions with a *Preview query type and gets the bytes TextOptions produced, so removing the aliases costs nothing while the GA query types wait on server 9.0. Removed: the TextOptions class, EncryptOptions.TextOptions, the two constructors and the With overload taking TextOptions, the _textOptions field, the CreateDocument extension for it, and EncryptionAlgorithm.TextPreview. The validation and marshalling paths that had to consider both options types collapse to StringOptions alone, which retires six CS0618 suppressions. Behaviour change beyond the removals: the string "TextPreview" passed to the string-algorithm constructor no longer translates to "String". Enum.TryParse now fails for it, so it is forwarded verbatim and the server rejects it. The two InlineData cases asserting the old translation are removed along with With_textOptions_should_create_new_instance_with_updated_textOptions, whose StringOptions twin already covers the same ground. The enum's remaining ordinals are deliberately left unpinned. The integers are not part of the wire contract, the enum never declared explicit values, and anything still holding a stale ordinal is already broken by the rest of this branch. AGENTS.md is corrected: it claimed the enum integer was part of the on-the-wire contract, which is what argued for pinning. Removing public API is a breaking change and targets the 4.0 major release.
Two layers existed only to serve two options types that rendered identically. With TextOptions gone each has a single caller and can be inlined: - CreateStringOptionsDocument took the five field values positionally so that the StringOptions and TextOptions extensions could share a body. Its logic now lives in CreateDocument(this StringOptions), which reads the properties directly. This matches CreateDocument(this RangeOptions) immediately above it. - EncryptOptions.GetStringOptionsDocument picked between _stringOptions and _textOptions. Both call sites in ExplicitEncryptionLibMongoCryptController now use encryptOptions.StringOptions?.CreateDocument(), which is the shape the neighbouring RangeOptions argument already had. Applied to the sync and async encrypt paths alike. No behaviour change: same element names, same order, same conditional inclusion, and the deferred lambdas still guard the null sub-option cases. Adds the two unit tests that were missing for this rendering. StringOptions' rendered document had no unit coverage at all — only the QE-Text-* spec fixtures exercised it, and those need CRYPT_SHARED_LIB_PATH, so the shape was unverifiable on a plain local run. Both tests were written against the previous implementation first and pass on either, so they pin the rendering rather than this refactor.
The value was unreachable, not merely deprecated. Nothing in the driver ever assigned it: HelloResult reads the hello reply's "passives" array only to enumerate member endpoints, and classifies those members as ReplicaSetSecondary. The SDAM spec requires exactly that -- see specifications/server-discovery-and-monitoring/tests/rs/discover_passives.json, where a member with "passive": true is expected to have type "RSSecondary". It was also unusable by callers. ServerTypeExtensions.ToClusterType has no case for it, so passing it fell through to the default label and threw ArgumentException; IsWritable would have returned false via its own default. The remaining ordinals are left unpinned, as with the encryption algorithm enum earlier in this branch. ServerType's integers are not a wire value -- the wire carries hello fields, and the driver compares enum members -- and the enum only pins Unknown = 0. Removing public API is a breaking change and targets the 4.0 major release.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes a broad set of long-obsolete public APIs across the MongoDB C# driver (and related test infrastructure), aligning the codebase and tests with the newer replacement surfaces (e.g., CountDocuments, TLS options, PasswordEvidence, QE StringOptions).
Changes:
- Removes multiple obsolete public APIs (e.g., legacy
Count*,MapReduce*, SSL/TLS aliases, deprecated feature/selector/types) and their internal implementations. - Updates unit/spec/smoke tests to use supported replacements and skips spec operations that no longer exist (e.g.,
count,mapReduce). - Simplifies Queryable Encryption option plumbing by removing deprecated QE aliases (
TextPreview/TextOptions) and consistently usingStringOptions.
Reviewed changes
Copilot reviewed 100 out of 100 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/SmokeTests/MongoDB.Driver.SmokeTests.Sdk/LibmongocryptTests.cs | Removes an obsolete-API-based workaround/assertion block from the smoke test. |
| tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedTestOperationFactory.cs | Skips unified spec operations for removed helpers (count, mapReduce). |
| tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedMapReduceOperation.cs | Removes unified test operation that relied on obsolete MapReduce. |
| tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedCountOperation.cs | Removes unified test operation that relied on obsolete Count. |
| tests/MongoDB.Driver.Tests/Specifications/connection-string/ConnectionStringTestRunner.cs | Switches ssl assertions to Tls (alias behavior). |
| tests/MongoDB.Driver.Tests/Specifications/auth/AuthTestRunner.cs | Moves password assertion to PasswordEvidence instead of obsolete Password. |
| tests/MongoDB.Driver.Tests/ServerSessionTests.cs | Removes tests for obsolete ServerSession no-op methods. |
| tests/MongoDB.Driver.Tests/OfTypeMongoCollectionTests.cs | Removes legacy Count/MapReduce tests; shifts integration assertions to CountDocuments. |
| tests/MongoDB.Driver.Tests/MongoUrlTests.cs | Removes assertions referencing obsolete SSL properties. |
| tests/MongoDB.Driver.Tests/MongoUrlBuilderTests.cs | Removes test coverage for obsolete SSL properties in builder. |
| tests/MongoDB.Driver.Tests/MongoDatabaseTests.cs | Removes UseCursor obsolete option usage/assertions in aggregate tests. |
| tests/MongoDB.Driver.Tests/MongoCredentialTests.cs | Updates password test to validate via PasswordEvidence. |
| tests/MongoDB.Driver.Tests/MongoCollectionImplTests.cs | Removes tests for obsolete Count and MapReduce behavior; removes obsolete index option checks. |
| tests/MongoDB.Driver.Tests/MongoClientSettingsTests.cs | Updates defaults/equality tests to use AllowInsecureTls and drops obsolete SSL members. |
| tests/MongoDB.Driver.Tests/Linq/Integration/GridFSFileInfoFindProjectionTests.cs | Removes tests for obsolete IdAsBsonValue projection. |
| tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenTestFactory.cs | Skips json-driven operations for removed helpers (count, mapReduce). |
| tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenMapReduceTest.cs | Removes json-driven test relying on obsolete MapReduce. |
| tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenCountTest.cs | Removes json-driven test relying on obsolete Count. |
| tests/MongoDB.Driver.Tests/IndexKeysDefinitionBuilderTests.cs | Removes tests for obsolete GeoHaystack index builder. |
| tests/MongoDB.Driver.Tests/IMongoCollectionExtensionsTests.cs | Removes tests for obsolete Count extension methods. |
| tests/MongoDB.Driver.Tests/GridFS/GridFSFileInfoTests.cs | Removes assertions for obsolete IdAsBsonValue. |
| tests/MongoDB.Driver.Tests/FindFluentTests.cs | Removes tests covering obsolete fluent Count. |
| tests/MongoDB.Driver.Tests/Encryption/EncryptOptionsTests.cs | Replaces deprecated QE text-alias tests with StringOptions document rendering tests. |
| tests/MongoDB.Driver.Tests/Encryption/ClientEncryptionTests.cs | Removes tests targeting obsolete CreateEncryptedCollection overload behavior. |
| tests/MongoDB.Driver.Tests/Core/Servers/ServerDescriptionWithSimilarLastUpdateTimestampEqualityComparer.cs | Drops equality comparison involving obsolete ServerDescription.Version. |
| tests/MongoDB.Driver.Tests/Core/Servers/ServerDescriptionTests.cs | Removes tests for obsolete ServerDescription.Version. |
| tests/MongoDB.Driver.Tests/Core/Operations/MapReduceOperationBaseTests.cs | Removes core operation tests for obsolete map-reduce operations. |
| tests/MongoDB.Driver.Tests/Core/Operations/CreateIndexRequestTests.cs | Removes tests for obsolete BucketSize option. |
| tests/MongoDB.Driver.Tests/Core/Operations/AggregateOperationTests.cs | Removes tests and checks for obsolete UseCursor behavior. |
| tests/MongoDB.Driver.Tests/Core/DatabaseNamespaceTests.cs | Removes tests for obsolete SystemIndexesCollection/SystemNamespacesCollection. |
| tests/MongoDB.Driver.Tests/Core/Connections/ConnectionIdTests.cs | Removes test for obsolete ServerValue property. |
| tests/MongoDB.Driver.Tests/Core/Configuration/ConnectionStringTests.cs | Moves ssl/sslVerifyCertificate tests to Tls/TlsInsecure behavior. |
| tests/MongoDB.Driver.Tests/Communication/Security/PlainAuthenticationTests.cs | Replaces obsolete Count usage with CountDocuments. |
| tests/MongoDB.Driver.Tests/CausalConsistencyTests.cs | Updates captured command expectations from count to aggregate due to CountDocuments. |
| tests/MongoDB.Driver.TestHelpers/Core/JsonDrivenTests/CommandStartedEventAsserter.cs | Removes special-case mapReduce “out” equivalence logic. |
| tests/MongoDB.Bson.Tests/ObjectModel/BsonDocumentTests.cs | Removes tests for obsolete BsonDocument(params BsonElement[]) constructor. |
| src/MongoDB.Driver/ServerSession.cs | Removes obsolete IServerSession members (AdvanceTransactionNumber, WasUsed). |
| src/MongoDB.Driver/PipelineDefinition.cs | Removes obsolete Serializer alias for OutputSerializer. |
| src/MongoDB.Driver/MongoUrlBuilder.cs | Removes obsolete UseSsl/VerifySslCertificate properties. |
| src/MongoDB.Driver/MongoUrl.cs | Removes obsolete UseSsl/VerifySslCertificate properties. |
| src/MongoDB.Driver/MongoIndexManagerBase.cs | Removes obsolete CreateOne* overloads that accept raw keys/options. |
| src/MongoDB.Driver/MongoDatabase.cs | Removes obsolete UseCursor propagation for aggregate operations. |
| src/MongoDB.Driver/MongoCredential.cs | Removes obsolete Password property in favor of Evidence. |
| src/MongoDB.Driver/MongoCollectionImpl.cs | Removes obsolete Count* and MapReduce* implementations and related helper code. |
| src/MongoDB.Driver/MongoCollectionBase.cs | Removes obsolete Count*/MapReduce* surface from base class. |
| src/MongoDB.Driver/MongoClientSettings.cs | Removes obsolete UseSsl/VerifySslCertificate members. |
| src/MongoDB.Driver/MapReduceOptions.cs | Removes obsolete map-reduce options types. |
| src/MongoDB.Driver/IServerSession.cs | Removes obsolete members from public IServerSession interface. |
| src/MongoDB.Driver/IndexKeysDefinitionBuilder.cs | Removes obsolete GeoHaystack builder APIs and implementation type. |
| src/MongoDB.Driver/IMongoIndexManager.cs | Removes obsolete index creation overloads from public interface. |
| src/MongoDB.Driver/IMongoCollectionExtensions.cs | Removes obsolete Count* extension methods. |
| src/MongoDB.Driver/IMongoCollection.cs | Removes obsolete Count* and MapReduce* members from public interface. |
| src/MongoDB.Driver/IFindFluent.cs | Removes obsolete fluent Count/CountAsync. |
| src/MongoDB.Driver/IAggregateFluentExtensions.cs | Removes an obsolete Unwind overload. |
| src/MongoDB.Driver/IAggregateFluent.cs | Removes obsolete Unwind overload from interface. |
| src/MongoDB.Driver/GridFS/GridFSFileInfoCompat.cs | Removes obsolete IdAsBsonValue exposure. |
| src/MongoDB.Driver/FindFluentBase.cs | Removes obsolete fluent Count members from base class. |
| src/MongoDB.Driver/FindFluent.cs | Removes obsolete fluent Count implementations. |
| src/MongoDB.Driver/FilteredMongoCollectionBase.cs | Removes obsolete Count*/MapReduce* forwarding implementations. |
| src/MongoDB.Driver/FieldDefinition.cs | Removes obsolete RenderedFieldDefinition constructor overload. |
| src/MongoDB.Driver/CreateIndexOptions.cs | Removes obsolete BucketSize option and coercion. |
| src/MongoDB.Driver/CreateCollectionOptions.cs | Removes obsolete NoPadding and UsePowerOf2Sizes options. |
| src/MongoDB.Driver/Core/WireProtocol/Messages/Encoders/MessageEncoderSettings.cs | Removes obsolete encoder setting name (GuidRepresentation). |
| src/MongoDB.Driver/Core/Servers/ServerType.cs | Removes obsolete enum member ReplicaSetPassive. |
| src/MongoDB.Driver/Core/Servers/ServerDescription.cs | Removes obsolete Version property. |
| src/MongoDB.Driver/Core/Servers/Server.cs | Removes obsolete Invalidate(string) overload. |
| src/MongoDB.Driver/Core/Operations/MapReduceOutputToCollectionOperation.cs | Removes obsolete map-reduce operation implementation (output to collection). |
| src/MongoDB.Driver/Core/Operations/MapReduceOutputMode.cs | Removes obsolete map-reduce output mode enum. |
| src/MongoDB.Driver/Core/Operations/MapReduceOperationBase.cs | Removes obsolete map-reduce operation base type. |
| src/MongoDB.Driver/Core/Operations/MapReduceOperation.cs | Removes obsolete map-reduce read operation implementation. |
| src/MongoDB.Driver/Core/Operations/CreateIndexRequest.cs | Removes obsolete BucketSize support from index request serialization. |
| src/MongoDB.Driver/Core/Operations/AggregateOperation.cs | Removes obsolete UseCursor handling. |
| src/MongoDB.Driver/Core/MongoConnectionException.cs | Removes obsolete ContainsSocketTimeoutException property. |
| src/MongoDB.Driver/Core/Misc/SemaphoreSlimRequest.cs | Removes obsolete SemaphoreSlimRequest type. |
| src/MongoDB.Driver/Core/Misc/HintForFindAndModifyFeature.cs | Removes obsolete hint feature helper type. |
| src/MongoDB.Driver/Core/Misc/Feature.cs | Removes obsolete feature flags that are tautologies for supported server ranges. |
| src/MongoDB.Driver/Core/Misc/BatchableSource.cs | Removes obsolete constructors. |
| src/MongoDB.Driver/Core/Events/ServerHeartbeatFailedEvent.cs | Removes obsolete constructor overload. |
| src/MongoDB.Driver/Core/Events/ConnectionSentMessagesEvent.cs | Removes obsolete multi-message constructor and RequestIds property. |
| src/MongoDB.Driver/Core/Events/ConnectionSendingMessagesFailedEvent.cs | Removes obsolete multi-message constructor and RequestIds property. |
| src/MongoDB.Driver/Core/Events/ConnectionSendingMessagesEvent.cs | Removes obsolete multi-message constructor and RequestIds property. |
| src/MongoDB.Driver/Core/DatabaseNamespace.cs | Removes obsolete internal system collection namespace helpers. |
| src/MongoDB.Driver/Core/Connections/ConnectionId.cs | Removes obsolete LocalValue and ServerValue aliases. |
| src/MongoDB.Driver/Core/Connections/ConnectionDescription.cs | Removes obsolete ServerVersion alias. |
| src/MongoDB.Driver/Core/Configuration/ConnectionString.cs | Removes obsolete Ssl/SslVerifyCertificate aliases in favor of TLS properties. |
| src/MongoDB.Driver/Core/Clusters/ServerSelectors/PriorityServerSelector.cs | Removes obsolete public server selector. |
| src/MongoDB.Driver/Core/ChangeStreamUpdateDescription.cs | Updates docs to avoid linking to removed/obsolete DisambiguatedPaths property. |
| src/MongoDB.Driver/Core/ChangeStreamDocument.cs | Removes obsolete DisambiguatedPaths property. |
| src/MongoDB.Driver/Core/AGENTS.md | Updates internal documentation to reflect removed/updated obsolete types. |
| src/MongoDB.Driver/BulkWriteInsertOneResult.cs | Removes obsolete InsertedId alias. |
| src/MongoDB.Driver/AggregateOptions.cs | Removes obsolete UseCursor option. |
| src/MongoDB.Driver.Encryption/ExplicitEncryptionLibMongoCryptController.cs | Switches string-options BSON generation to StringOptions.CreateDocument() path. |
| src/MongoDB.Driver.Encryption/EncryptOptions.cs | Removes deprecated QE TextOptions and TextPreview algorithm alias handling; validates StringOptions. |
| src/MongoDB.Driver.Encryption/EncryptionOptionsExtensions.cs | Removes TextOptions document generation; uses StringOptions only. |
| src/MongoDB.Driver.Encryption/EncryptionAlgorithm.cs | Removes deprecated TextPreview enum member. |
| src/MongoDB.Driver.Encryption/ClientEncryption.cs | Removes obsolete CreateEncryptedCollection overloads using DataKeyOptions. |
| src/MongoDB.Driver.Encryption/AGENTS.md | Updates encryption guidance from TextPreview/TextOptions to String/StringOptions. |
| src/MongoDB.Bson/ObjectModel/BsonDocument.cs | Removes obsolete params BsonElement[] constructor. |
Suppressed comments (1)
src/MongoDB.Driver/IMongoCollection.cs:205
- This PR removes members from public interfaces (e.g., the legacy Count/CountAsync and MapReduce APIs). That’s a breaking public-surface change under SemVer, so the release/versioning and migration guidance need to reflect a major-version bump (and/or explicitly target the next major) rather than landing silently.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
papafe
approved these changes
Aug 5, 2026
| /// <returns> | ||
| /// The fluent aggregate interface. | ||
| /// </returns> | ||
| [Obsolete("Use the Unwind overload which takes an options parameter.")] |
Contributor
There was a problem hiding this comment.
AggregateFluentBase still has this Unwind overload. Should we remove it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the driver's accumulated
[Obsolete]public surface ahead of 4.0. Each commit covers one coherent group and is independently reviewable — going commit-by-commit will be much easier than reading the combined diff.Notes
1. GeoHaystack is the one removal that drops working functionality. Everything else here removes either dead code or a member with a live replacement. GeoHaystack is different: the driver's minimum server is 4.4, geoHaystack was deprecated in 4.4 and removed by the server in 5.0. So it still works against the oldest server we support and fails on everything newer. I think it's ok to remove now.
2.
countandmapReduceare now skipped in both spec-test factories, with a reason. The suites drivecountin 44 places. Every one of those paths is also covered bycountDocumentsorestimatedDocumentCount, and the spec's own test names call them "Deprecated count" — so I believe that no unique conformance coverage is lost.3. In
LibmongocryptTests. A SERVER-106469 workaround gated onServerDescription.Version, which this PR removes. Rather than port it the wholecatchis deleted: the ticket is Closed/Fixed in server 8.2.1, the smoke matrix runs5.0/6.0/7.0/8.0/latest, and left in place the block would swallow anyMongoEncryptionExceptionon Windows and skip theexpectedLogsassertions below it — turning a genuine failure green.4.
GridFSFileInfo's"IdAsBsonValue"string literal stays even though the property is gone. It's the registered serializer member name that the liveIdproperty reads_idthrough.Deliberately not removed
21
[Obsolete]members remain insrc/, all intentional:waitQueueSize/waitQueueMultiplefamily (14 members) — split out to CSHARP-6153. These aren't dead: they parse from the connection string and read through toExclusiveConnectionPool._waitQueueFreeSlots, which throwsMongoWaitQueueFullExceptionwhen exhausted. Removal is a behaviour decision, plus there's a coupling to untangle — the obsoleteMongoClientSettings.WaitQueueSizealso feeds the non-obsoleteClusterSettings.MaxServerSelectionWaitQueueSize.$readPreferenceand honoured by 4.4–7.x, i.e. most of the supported range. That makes the case for removal weaker than GeoHaystack's, which this PR does remove.BsonBinarySubType.OldBinary,MqlHashAlgorithm.MD5,DelegatingStream.CreateWaitHandle,OperationContext.CombinedCancellationToken— wire-format compatibility, deliberate legacy support, a BCL-obsoleted override, and aninternalmember that bridges to public interfaces taking a bareCancellationToken.