@@ -41,8 +41,8 @@ class Cursor(object):
4141 def __init__ (self , collection , spec = None , fields = None , skip = 0 , limit = 0 ,
4242 timeout = True , snapshot = False , tailable = False , sort = None ,
4343 max_scan = None , as_class = None , slave_okay = False ,
44- await_data = False , partial = False , _must_use_master = False ,
45- _is_command = False , ** kwargs ):
44+ await_data = False , partial = False , manipulate = True ,
45+ _must_use_master = False , _is_command = False , ** kwargs ):
4646 """Create a new cursor.
4747
4848 Should not be called directly by application developers - see
@@ -109,6 +109,7 @@ def __init__(self, collection, spec=None, fields=None, skip=0, limit=0,
109109 self .__hint = None
110110 self .__as_class = as_class
111111 self .__slave_okay = slave_okay
112+ self .__manipulate = manipulate
112113 self .__tz_aware = collection .database .connection .tz_aware
113114 self .__must_use_master = _must_use_master
114115 self .__is_command = _is_command
@@ -173,6 +174,7 @@ def clone(self):
173174 copy .__slave_okay = self .__slave_okay
174175 copy .__await_data = self .__await_data
175176 copy .__partial = self .__partial
177+ copy .__manipulate = self .__manipulate
176178 copy .__must_use_master = self .__must_use_master
177179 copy .__is_command = self .__is_command
178180 copy .__query_flags = self .__query_flags
@@ -651,10 +653,12 @@ def next(self):
651653 raise StopIteration
652654 db = self .__collection .database
653655 if len (self .__data ) or self ._refresh ():
654- next = db ._fix_outgoing (self .__data .pop (0 ), self .__collection )
656+ if self .__manipulate :
657+ return db ._fix_outgoing (self .__data .pop (0 ), self .__collection )
658+ else :
659+ return self .__data .pop (0 )
655660 else :
656661 raise StopIteration
657- return next
658662
659663 def __enter__ (self ):
660664 return self
0 commit comments