Skip to content

Commit 4bd195c

Browse files
CSHARP-2032: Drop support for MongoDB 2.4
1 parent 0fa0995 commit 4bd195c

File tree

53 files changed

+592
-1684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+592
-1684
lines changed

src/MongoDB.Driver.Core/Core/Misc/Feature.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public class Feature
4141
private static readonly ArrayFiltersFeature __arrayFilters = new ArrayFiltersFeature("ArrayFilters", new SemanticVersion(3, 5, 11));
4242
private static readonly Feature __bypassDocumentValidation = new Feature("BypassDocumentValidation", new SemanticVersion(3, 2, 0));
4343
private static readonly Feature __changeStreamStage = new Feature("ChangeStreamStage", new SemanticVersion(3, 5, 11));
44-
private static readonly Feature __changeStreamPostBatchResumeToken = new Feature("ChangeStreamPostBatchResumeToken", new SemanticVersion(4, 0 ,7));
44+
private static readonly Feature __changeStreamPostBatchResumeToken = new Feature("ChangeStreamPostBatchResumeToken", new SemanticVersion(4, 0, 7));
4545
private static readonly Feature __clientSideEncryption = new Feature("ClientSideEncryption", new SemanticVersion(4, 1, 9));
4646
private static readonly CollationFeature __collation = new CollationFeature("Collation", new SemanticVersion(3, 3, 11));
4747
private static readonly Feature __commandMessage = new Feature("CommandMessage", new SemanticVersion(3, 6, 0));
4848
private static readonly CommandsThatWriteAcceptWriteConcernFeature __commandsThatWriteAcceptWriteConcern = new CommandsThatWriteAcceptWriteConcernFeature("CommandsThatWriteAcceptWriteConcern", new SemanticVersion(3, 3, 11));
49-
private static readonly Feature __createIndexesCommand = new Feature("CreateIndexesCommand", new SemanticVersion(3, 0, 0));
49+
private static readonly Feature __createIndexesCommand = new Feature("CreateIndexesCommand", new SemanticVersion(2, 6, 0));
5050
private static readonly Feature __createIndexesUsingInsertOperations = new Feature("CreateIndexesUsingInsertOperations", new SemanticVersion(1, 0, 0), new SemanticVersion(4, 1, 1, ""));
5151
private static readonly Feature __currentOpCommand = new Feature("CurrentOpCommand", new SemanticVersion(3, 2, 0));
5252
private static readonly Feature __documentValidation = new Feature("DocumentValidation", new SemanticVersion(3, 2, 0));
@@ -369,14 +369,14 @@ public class Feature
369369
public static Feature Views => __views;
370370

371371
/// <summary>
372-
/// Gets the write commands feature.
372+
/// Gets the wildcard indexes feature.
373373
/// </summary>
374-
public static Feature WriteCommands => __writeCommands;
374+
public static Feature WildcardIndexes => __wildcardIndexes;
375375

376376
/// <summary>
377-
/// Gets the wildcard indexes feature.
377+
/// Gets the write commands feature.
378378
/// </summary>
379-
public static Feature WildcardIndexes => __wildcardIndexes;
379+
public static Feature WriteCommands => __writeCommands;
380380
#endregion
381381

382382
private readonly string _name;

src/MongoDB.Driver.Core/Core/Operations/AggregateOperation.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,13 @@ internal BsonDocument CreateCommand(ConnectionDescription connectionDescription,
344344
{ "readConcern", readConcern, readConcern != null }
345345
};
346346

347-
if (Feature.AggregateCursorResult.IsSupported(connectionDescription.ServerVersion))
347+
var useCursor = _useCursor.GetValueOrDefault(true) || connectionDescription.ServerVersion >= new SemanticVersion(3, 6, 0);
348+
if (useCursor)
348349
{
349-
var useCursor = _useCursor.GetValueOrDefault(true) || connectionDescription.ServerVersion >= new SemanticVersion(3, 6, 0);
350-
if (useCursor)
350+
command["cursor"] = new BsonDocument
351351
{
352-
command["cursor"] = new BsonDocument
353-
{
354-
{ "batchSize", () => _batchSize.Value, _batchSize.HasValue }
355-
};
356-
}
352+
{ "batchSize", () => _batchSize.Value, _batchSize.HasValue }
353+
};
357354
}
358355

359356
return command;

src/MongoDB.Driver.Core/Core/Operations/BulkDeleteOperation.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ protected override IRetryableWriteOperation<BsonDocument> CreateBatchOperation(B
4343
};
4444
}
4545

46-
protected override IExecutableInRetryableWriteContext<BulkWriteOperationResult> CreateEmulator()
47-
{
48-
return new BulkDeleteOperationEmulator(CollectionNamespace, Requests, MessageEncoderSettings)
49-
{
50-
IsOrdered = IsOrdered,
51-
MaxBatchCount = MaxBatchCount,
52-
MaxBatchLength = MaxBatchLength,
53-
WriteConcern = WriteConcern
54-
};
55-
}
56-
5746
protected override bool RequestHasCollation(DeleteRequest request)
5847
{
5948
return request.Collation != null;

src/MongoDB.Driver.Core/Core/Operations/BulkDeleteOperationEmulator.cs

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/MongoDB.Driver.Core/Core/Operations/BulkInsertOperation.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ protected override IRetryableWriteOperation<BsonDocument> CreateBatchOperation(B
4646
};
4747
}
4848

49-
protected override IExecutableInRetryableWriteContext<BulkWriteOperationResult> CreateEmulator()
50-
{
51-
return new BulkInsertOperationEmulator(CollectionNamespace, Requests, MessageEncoderSettings)
52-
{
53-
IsOrdered = IsOrdered,
54-
MaxBatchCount = MaxBatchCount,
55-
MaxBatchLength = MaxBatchLength,
56-
WriteConcern = WriteConcern
57-
};
58-
}
59-
6049
protected override bool RequestHasCollation(InsertRequest request)
6150
{
6251
return false;

src/MongoDB.Driver.Core/Core/Operations/BulkInsertOperationEmulator.cs

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/MongoDB.Driver.Core/Core/Operations/BulkUnmixedWriteOperationBase.cs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,8 @@ public WriteConcern WriteConcern
116116
public BulkWriteOperationResult Execute(RetryableWriteContext context, CancellationToken cancellationToken)
117117
{
118118
EnsureCollationIsSupportedIfAnyRequestHasCollation(context, _requests);
119-
if (Feature.WriteCommands.IsSupported(context.Channel.ConnectionDescription.ServerVersion))
120-
{
121-
return ExecuteBatches(context, cancellationToken);
122-
}
123-
else
124-
{
125-
var emulator = CreateEmulator();
126-
return emulator.Execute(context, cancellationToken);
127-
}
119+
120+
return ExecuteBatches(context, cancellationToken);
128121
}
129122

130123
public BulkWriteOperationResult Execute(IWriteBinding binding, CancellationToken cancellationToken)
@@ -140,15 +133,8 @@ public BulkWriteOperationResult Execute(IWriteBinding binding, CancellationToken
140133
public Task<BulkWriteOperationResult> ExecuteAsync(RetryableWriteContext context, CancellationToken cancellationToken)
141134
{
142135
EnsureCollationIsSupportedIfAnyRequestHasCollation(context, _requests);
143-
if (Feature.WriteCommands.IsSupported(context.Channel.ConnectionDescription.ServerVersion))
144-
{
145-
return ExecuteBatchesAsync(context, cancellationToken);
146-
}
147-
else
148-
{
149-
var emulator = CreateEmulator();
150-
return emulator.ExecuteAsync(context, cancellationToken);
151-
}
136+
137+
return ExecuteBatchesAsync(context, cancellationToken);
152138
}
153139

154140
public async Task<BulkWriteOperationResult> ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)
@@ -164,8 +150,6 @@ public async Task<BulkWriteOperationResult> ExecuteAsync(IWriteBinding binding,
164150
// protected methods
165151
protected abstract IRetryableWriteOperation<BsonDocument> CreateBatchOperation(Batch batch);
166152

167-
protected abstract IExecutableInRetryableWriteContext<BulkWriteOperationResult> CreateEmulator();
168-
169153
protected abstract bool RequestHasCollation(TWriteRequest request);
170154

171155
// private methods

src/MongoDB.Driver.Core/Core/Operations/BulkUpdateOperation.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@ protected override IRetryableWriteOperation<BsonDocument> CreateBatchOperation(B
4444
};
4545
}
4646

47-
protected override IExecutableInRetryableWriteContext<BulkWriteOperationResult> CreateEmulator()
48-
{
49-
return new BulkUpdateOperationEmulator(CollectionNamespace, Requests, MessageEncoderSettings)
50-
{
51-
IsOrdered = IsOrdered,
52-
MaxBatchCount = MaxBatchCount,
53-
MaxBatchLength = MaxBatchLength,
54-
WriteConcern = WriteConcern
55-
};
56-
}
57-
5847
protected override bool RequestHasCollation(UpdateRequest request)
5948
{
6049
return request.Collation != null;

src/MongoDB.Driver.Core/Core/Operations/BulkUpdateOperationEmulator.cs

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)