class Mongo::Operation::ParallelScan::Result

Defines custom behavior of results in a parallel scan.

@since 2.0.0 @api semiprivate

Constants

CURSORS

The name of the cursors field in the result.

@since 2.0.0 @api private

Public Instance Methods

cursor_ids() click to toggle source

Get all the cursor ids from the result.

@example Get the cursor ids.

result.cursor_ids

@return [ Array<Integer> ] The cursor ids.

@since 2.0.0 @api private

# File lib/mongo/operation/parallel_scan/result.rb, line 43
def cursor_ids
  documents.map {|doc| doc[CURSOR][CURSOR_ID]}
end
documents() click to toggle source

Get the documents from parallel scan.

@example Get the documents.

result.documents

@return [ Array<BSON::Document> ] The documents.

@since 2.0.0 @api public

# File lib/mongo/operation/parallel_scan/result.rb, line 56
def documents
  reply.documents[0][CURSORS]
end

Private Instance Methods

first() click to toggle source
# File lib/mongo/operation/parallel_scan/result.rb, line 62
def first
  @first ||= reply.documents[0] || {}
end