Class: Mongo::Operation::ParallelScan::Result Private

Inherits:
Result
  • Object
show all
Defined in:
lib/mongo/operation/parallel_scan/result.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defines custom behavior of results in a parallel scan.

Since:

  • 2.0.0

Constant Summary collapse

CURSORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The name of the cursors field in the result.

Since:

  • 2.0.0

'cursors'.freeze

Constants inherited from Result

Result::CURSOR, Result::CURSOR_ID, Result::FIRST_BATCH, Result::N, Result::NAMESPACE, Result::NEXT_BATCH, Result::OK, Result::RESULT

Instance Attribute Summary

Attributes inherited from Result

#replies

Instance Method Summary collapse

Methods inherited from Result

#acknowledged?, #cluster_time, #cursor_id, #each, #initialize, #inspect, #labels, #multiple?, #namespace, #ok?, #operation_time, #reply, #returned_count, #successful?, #validate!, #written_count

Constructor Details

This class inherits a constructor from Mongo::Operation::Result

Instance Method Details

#cursor_idsArray<Integer>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get all the cursor ids from the result.

Examples:

Get the cursor ids.

result.cursor_ids

Returns:

  • (Array<Integer>)

    The cursor ids.

Since:

  • 2.0.0



37
38
39
# File 'lib/mongo/operation/parallel_scan/result.rb', line 37

def cursor_ids
  documents.map {|doc| doc[CURSOR][CURSOR_ID]}
end

#documentsArray<BSON::Document>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the documents from parallel scan.

Examples:

Get the documents.

result.documents

Returns:

  • (Array<BSON::Document>)

    The documents.

Since:

  • 2.0.0



49
50
51
# File 'lib/mongo/operation/parallel_scan/result.rb', line 49

def documents
  reply.documents[0][CURSORS]
end