Skip to content

Commit 6e44d1f

Browse files
committed
CSHARP-1903: Fix minor bug in use cursor with latest server version.
1 parent f73c274 commit 6e44d1f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ private ReadCommandOperation<AggregateResult> CreateOperation(IChannelHandle cha
266266

267267
private AsyncCursor<TResult> CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument command, AggregateResult result)
268268
{
269-
if (Feature.AggregateCursorResult.IsSupported(channel.ConnectionDescription.ServerVersion) && _useCursor.GetValueOrDefault(true))
269+
if (result.CursorId.HasValue)
270270
{
271271
return CreateCursorFromCursorResult(channelSource, command, result);
272272
}
273-
274-
return CreateCursorFromInlineResult(command, result);
273+
else
274+
{
275+
return CreateCursorFromInlineResult(command, result);
276+
}
275277
}
276278

277279
private AsyncCursor<TResult> CreateCursorFromCursorResult(IChannelSourceHandle channelSource, BsonDocument command, AggregateResult result)

0 commit comments

Comments
 (0)