lib/mongo/cursor.rb
# Return the next object or nil if there are no more. Raises an error
# if necessary.
Return the next object or nil if there are no more. Raises an error
if necessary.
Return the next object or nil if there are no more . Raises an error if necessary .
def next_object
          refill_via_get_more if num_remaining == 0
          o = @cache.shift
          if o && o['$err']
            err = o['$err']
            @db.close if err == "not master"
            raise err
          end
          o
        end
def next_object refill_via_get_more if num_remaining == 0 o = @cache . shift if o && o [ '$err' ] err = o [ '$err' ] @db . close if err == "not master" raise err end o end
Return the next object or nil if there are no more.
Return the next object or nil if there are no more .
# If the server has stopped being the master (e.g., it's one of a # pair but it has died or something like that) then we close that # connection. If the db has auto connect option and a pair of # servers, next request will re-open on master server.