Class: Mongo::Operation::CollectionsInfo::Result

Inherits:
Result
  • Object
show all
Defined in:
build/ruby-driver-master/lib/mongo/operation/collections_info/result.rb

Overview

Defines custom behavior of results when query the system.namespaces collection.

Since:

  • 2.1.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_description, #replies

Instance Method Summary collapse

Methods inherited from Result

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

Constructor Details

#initialize(replies, connection_description, database_name) ⇒ Result

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.

Initialize a new result.

Parameters:

  • replies (Array<Protocol::Message> | nil)

    The wire protocol replies, if any.

  • connection_description (Server::Description)

    Server description of the server that performed the operation that this result is for.

  • database_name (String)

    The name of the database that the query was sent to.

Since:

  • 2.1.0



39
40
41
42
# File 'build/ruby-driver-master/lib/mongo/operation/collections_info/result.rb', line 39

def initialize(replies, connection_description, database_name)
  super(replies, connection_description)
  @database_name = database_name
end

Instance Method Details

#namespaceString

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 namespace for the cursor.

Examples:

Get the namespace.

result.namespace

Returns:

  • (String)

    The namespace.

Since:

  • 2.1.0



53
54
55
# File 'build/ruby-driver-master/lib/mongo/operation/collections_info/result.rb', line 53

def namespace
  "#{@database_name}.#{Database::NAMESPACES}"
end