diff --git a/source/MongoDB/Cursor_1.cs b/source/MongoDB/Cursor_1.cs index d4c46db6..a9658d1a 100644 --- a/source/MongoDB/Cursor_1.cs +++ b/source/MongoDB/Cursor_1.cs @@ -22,6 +22,7 @@ public class Cursor : ICursor where T : class private QueryOptions _options; private ReplyMessage _reply; private int _skip; + private bool _keepCursor; private readonly ISerializationFactory _serializationFactory; /// @@ -164,7 +165,22 @@ public Cursor(ISerializationFactory serializationFactory, Connection connection, TryModify(); AddOrRemoveSpecOpt("$hint", index); return this; - } + } + + /// + /// Keeps the cursor open. + /// + /// if set to true [value]. + /// + /// + /// By default cursors are closed automaticly after documents + /// are Enumerated. + /// + public ICursor KeepCursor(bool value) + { + _keepCursor = value; + return this; + } /// /// Snapshots the specified index. @@ -173,7 +189,7 @@ public Cursor(ISerializationFactory serializationFactory, Connection connection, TryModify(); AddOrRemoveSpecOpt("$snapshot", true); return this; - } + } /// /// Explains this instance. @@ -223,6 +239,9 @@ public Cursor(ISerializationFactory serializationFactory, Connection connection, yield return document; } while(Id > 0 && _limit : IDisposable /// ICursor Hint(object index); + /// + /// Keeps the cursor open. + /// + /// if set to true [value]. + /// + /// + /// By default cursors are closed automaticly after documents + /// are Enumerated. + /// + ICursor KeepCursor(bool value); + /// /// Snapshots this instance. /// diff --git a/source/MongoDB/Obsolete/Cursor.cs b/source/MongoDB/Obsolete/Cursor.cs index 30ad7dd8..df9a3443 100644 --- a/source/MongoDB/Obsolete/Cursor.cs +++ b/source/MongoDB/Obsolete/Cursor.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; namespace MongoDB @@ -116,6 +117,21 @@ public long Id return this; } + /// + /// Keeps the cursor open. + /// + /// if set to true [value]. + /// + /// + /// By default cursors are closed automaticly after documents + /// are Enumerated. + /// + public ICursor KeepCursor(bool value) + { + _cursor.KeepCursor(value); + return this; + } + /// /// Snapshots this instance. /// diff --git a/source/MongoDB/Obsolete/ICursor.cs b/source/MongoDB/Obsolete/ICursor.cs index 8c69c114..7b829c40 100644 --- a/source/MongoDB/Obsolete/ICursor.cs +++ b/source/MongoDB/Obsolete/ICursor.cs @@ -74,9 +74,20 @@ public interface ICursor : IDisposable /// Hints the specified index. /// /// The index. - /// + /// ICursor Hint(Document index); - + + /// + /// Keeps the cursor open. + /// + /// if set to true [value]. + /// + /// + /// By default cursors are closed automaticly after documents + /// are Enumerated. + /// + ICursor KeepCursor(bool value); + /// /// Snapshots this instance. ///