class Mongo::Operation::ParallelScan::Result

Defines custom behavior of results in a parallel scan.

@since 2.0.0

Constants

CURSORS

The name of the cursors field in the result.

@since 2.0.0

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

# File lib/mongo/operation/parallel_scan/result.rb, line 37
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

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

Private Instance Methods

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