lib/mongo/collection/view/readable.rb
# Execute an aggregation on the collection view.
#
# @example Aggregate documents.
#   view.aggregate([
#     { "$group" => { "_id" => "$city", "tpop" => { "$sum" => "$pop" }}}
#   ])
#
# @param [ Array<Hash> ] pipeline The aggregation pipeline.
# @param [ Hash ] options The aggregation options.
#
# @return [ Aggregation ] The aggregation object.
#
# @since 2.0.0
Execute an aggregation on the collection view.
Execute an aggregation on the collection view .
def parallel_scan(cursor_count, options = {})
          if options[:session]
            session = client.send(:get_session, @options)
          else
            session = nil
          end
          server = server_selector.select_server(cluster, nil, session)
          spec = {
            coll_name: collection.name,
            db_name: database.name,
            cursor_count: cursor_count,
            read_concern: read_concern,
            session: session,
          }.update(options)
          session = spec[:session]
          op = Operation::ParallelScan.new(spec)
          context = Operation::Context.new(client: client, session: session)
          result = op.execute(server, context: context)
          result.cursor_ids.map do |cursor_id|
            spec = {
              cursor_id: cursor_id,
              coll_name: collection.name,
              db_name: database.name,
              session: session,
              batch_size: batch_size,
              to_return: 0,
            }
            op = Operation::GetMore.new(spec)
            context = Operation::Context.new(
              client: client,
              session: session,
              service_id: result.connection_description.service_id,
            )
            result = op.execute(server, context: context)
            Cursor.new(self, result, server, session: session)
          end
        end
def parallel_scan ( cursor_count , options = { } ) if options [ :session ] session = client . send ( :get_session , @options ) else session = nil end server = server_selector . select_server ( cluster , nil , session ) spec = { coll_name : collection . name , db_name : database . name , cursor_count : cursor_count , read_concern : read_concern , session : session , } . update ( options ) session = spec [ :session ] op = Operation :: ParallelScan . new ( spec ) context = Operation :: Context . new ( client : client , session : session ) result = op . execute ( server , context : context ) result . cursor_ids . map do | cursor_id | spec = { cursor_id : cursor_id , coll_name : collection . name , db_name : database . name , session : session , batch_size : batch_size , to_return : 0 , } op = Operation :: GetMore . new ( spec ) context = Operation :: Context . new ( client : client , session : session , service_id : result . connection_description . service_id , ) result = op . execute ( server , context : context ) Cursor . new ( self , result , server , session : session ) end end
Execute an aggregation on the collection view.
Execute an aggregation on the collection view .
# The session would be overwritten by the one in +options+ later. # Note that the context object shouldn't be reused for subsequent # GetMore operations. # max_time_ms is not being passed here, I assume intentionally?
The aggregation object.
The aggregation object .
 Aggregation 
cursor_count
<not_specific>
options
<not_specific>
<not_specific>
options The aggregation options.
options The aggregation options .
example
None
since
None