Class: Mongo::Operation::Explain::Result

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

Overview

Defines custom behavior of results in find command with explain.

Since:

  • 2.5.0

Constant Summary

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

#connection, #connection_description, #connection_global_id, #context, #replies

Instance Method Summary collapse

Methods inherited from Result

#acknowledged?, #cluster_time, #each, #error, #has_cursor_id?, #initialize, #inspect, #labels, #namespace, #ok?, #operation_time, #reply, #returned_count, #snapshot_timestamp, #successful?, #topology_version, #validate!, #write_concern_error?, #written_count

Constructor Details

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

Instance Method Details

#cursor_id0

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 cursor id.

Examples:

Get the cursor id.

result.cursor_id

Returns:

  • (0)

    Always 0 because explain doesn’t return a cursor.

Since:

  • 2.5.0



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

def cursor_id
  0
end

#documentsArray<BSON::Document>

Get the documents in the result.

Examples:

Get the documents.

result.documents

Returns:

  • (Array<BSON::Document>)

    The documents.

Since:

  • 2.5.0



50
51
52
# File 'lib/mongo/operation/explain/result.rb', line 50

def documents
  reply.documents
end