File tree 1 file changed +6
-4
lines changed
MongoDB.Driver/Operations
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -83,25 +83,27 @@ public IEnumerator<TDocument> Execute(IConnectionProvider connectionProvider)
83
83
reply = GetFirstBatch ( connectionProvider ) ;
84
84
foreach ( var document in reply . Documents )
85
85
{
86
+ yield return document ;
87
+ count ++ ;
88
+
86
89
if ( limit != 0 && count == limit )
87
90
{
88
91
yield break ;
89
92
}
90
- yield return document ;
91
- count ++ ;
92
93
}
93
94
94
95
while ( reply . CursorId != 0 )
95
96
{
96
97
reply = GetNextBatch ( connectionProvider , reply . CursorId ) ;
97
98
foreach ( var document in reply . Documents )
98
99
{
100
+ yield return document ;
101
+ count ++ ;
102
+
99
103
if ( limit != 0 && count == limit )
100
104
{
101
105
yield break ;
102
106
}
103
- yield return document ;
104
- count ++ ;
105
107
}
106
108
107
109
if ( reply . CursorId != 0 && ( _flags & QueryFlags . TailableCursor ) != 0 )
You can’t perform that action at this time.
0 commit comments