@@ -43,6 +43,7 @@ public abstract class MongoCursor : IEnumerable
43
43
private IMongoFields _fields ;
44
44
private BsonDocument _options ;
45
45
private QueryFlags _flags ;
46
+ private TimeSpan ? _maxAwaitTime ;
46
47
private ReadConcern _readConcern = ReadConcern . Default ;
47
48
private ReadPreference _readPreference ;
48
49
private IBsonSerializer _serializer ;
@@ -165,6 +166,22 @@ public virtual QueryFlags Flags
165
166
}
166
167
}
167
168
169
+ /// <summary>
170
+ /// Gets or sets the maximum await time for TailableAwait cursors.
171
+ /// </summary>
172
+ /// <value>
173
+ /// The maximum await time for TailableAwait cursors.
174
+ /// </value>
175
+ public virtual TimeSpan ? MaxAwaitTime
176
+ {
177
+ get { return _maxAwaitTime ; }
178
+ set
179
+ {
180
+ if ( _isFrozen ) { ThrowFrozen ( ) ; }
181
+ _maxAwaitTime = value ;
182
+ }
183
+ }
184
+
168
185
/// <summary>
169
186
/// Gets the read concern.
170
187
/// </summary>
@@ -332,6 +349,7 @@ public virtual MongoCursor Clone(Type documentType, IBsonSerializer serializer)
332
349
clone . _flags = _flags ;
333
350
clone . _skip = _skip ;
334
351
clone . _limit = _limit ;
352
+ clone . _maxAwaitTime = _maxAwaitTime ;
335
353
clone . _batchSize = _batchSize ;
336
354
clone . _fields = _fields ;
337
355
return clone ;
@@ -511,6 +529,18 @@ public virtual MongoCursor SetMax(BsonDocument max)
511
529
return this ;
512
530
}
513
531
532
+ /// <summary>
533
+ /// Sets the maximum await time for tailable await cursors.
534
+ /// </summary>
535
+ /// <param name="value">The value.</param>
536
+ /// <returns>The cursor (so you can chain method calls to it).</returns>
537
+ public virtual MongoCursor SetMaxAwaitTime ( TimeSpan ? value )
538
+ {
539
+ if ( _isFrozen ) { ThrowFrozen ( ) ; }
540
+ _maxAwaitTime = value ;
541
+ return this ;
542
+ }
543
+
514
544
/// <summary>
515
545
/// Sets the maximum number of documents to scan.
516
546
/// </summary>
@@ -799,6 +829,7 @@ public virtual IEnumerator<TDocument> GetEnumerator()
799
829
CursorType = cursorType ,
800
830
Filter = queryDocument ,
801
831
Limit = Limit ,
832
+ MaxAwaitTime = MaxAwaitTime ,
802
833
Modifiers = Options ,
803
834
NoCursorTimeout = noCursorTimeout ,
804
835
Projection = Fields . ToBsonDocument ( ) ,
@@ -894,6 +925,16 @@ public virtual IEnumerator<TDocument> GetEnumerator()
894
925
return ( MongoCursor < TDocument > ) base . SetMax ( max ) ;
895
926
}
896
927
928
+ /// <summary>
929
+ /// Sets the maximum await time for tailable await cursors.
930
+ /// </summary>
931
+ /// <param name="value">The value.</param>
932
+ /// <returns>The cursor (so you can chain method calls to it).</returns>
933
+ public new virtual MongoCursor SetMaxAwaitTime ( TimeSpan ? value )
934
+ {
935
+ return ( MongoCursor < TDocument > ) base . SetMaxAwaitTime ( value ) ;
936
+ }
937
+
897
938
/// <summary>
898
939
/// Sets the maximum number of documents to scan.
899
940
/// </summary>
0 commit comments