lib/mongo/collection/view/change_stream.rb
# Return one document from the change stream, if one is available.
#
# Retries once on a resumable error.
#
# Raises StopIteration if the change stream is closed.
#
# This method will wait up to max_await_time_ms milliseconds
# for changes from the server, and if no changes are received
# it will return nil.
#
# @return [ BSON::Document | nil ] A change stream document.
# @since 2.6.0
Return one document from the change stream, if one is available.
Retries once on a resumable error.

Raises StopIteration if the change stream is closed.

This method will wait up to max_await_time_ms milliseconds
for changes from the server, and if no changes are received
it will return nil.
Return one document from the change stream if one is available . Retries once on a resumable error . Raises StopIteration if the change stream is closed . This method will wait up to max_await_time_ms milliseconds for changes from the server and if no changes are received it will return nil .
def try_next
          raise StopIteration.new if closed?
          begin
            doc = @cursor.try_next
          rescue Mongo::Error => e
            if !e.change_stream_resumable?
              raise
            end
            @resume_token = @cursor.resume_token
            close
            create_cursor!
            retry
          end
          if doc && doc['_id'].nil?
            raise Error::MissingResumeToken
          end
          doc
        end
def try_next raise StopIteration . new if closed? begin doc = @cursor . try_next rescue Mongo :: Error => e if ! e . change_stream_resumable? raise end @resume_token = @cursor . resume_token close create_cursor! retry end if doc && doc [ '_id' ] . nil? raise Error :: MissingResumeToken end doc end
Return one document from the change stream, if one is available.
Return one document from the change stream if one is available .
# Rerun initial aggregation. # Any errors here will stop iteration and break out of this # method. # Save cursor's resume token so we can use it # to create a new cursor # We need to verify each doc has an _id, so we # have a resume token to work with
A change stream document.
A change stream document .
 BSON::Document | nil 
since
None