Class: Mongo::Operation::ListCollections::Result Private
- Defined in:
- lib/mongo/operation/list_collections/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 when using the listCollections command.
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
-
#cursor_id ⇒ Integer
private
Get the cursor id for the result.
-
#documents ⇒ Array<BSON::Document>
private
Get the documents for the listCollections result.
-
#namespace ⇒ String
private
Get the namespace for the cursor.
-
#validate! ⇒ Result
private
Validate the result.
Methods inherited from Result
#acknowledged?, #cluster_time, #each, #error, #initialize, #inspect, #labels, #ok?, #operation_time, #reply, #returned_count, #successful?, #topology_version, #write_concern_error?, #written_count
Constructor Details
This class inherits a constructor from Mongo::Operation::Result
Instance Method Details
#cursor_id ⇒ 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.
Even though the wire protocol has a cursor_id field for all messages of type reply, it is always zero when using the listCollections command and must be retrieved from the cursor document itself.
Get the cursor id for the result.
38 39 40 |
# File 'lib/mongo/operation/list_collections/result.rb', line 38 def cursor_id cursor_document ? cursor_document[CURSOR_ID] : super end |
#documents ⇒ Array<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 for the listCollections result. It is the ‘firstBatch’
field in the 'cursor' field of the first document returned.
63 64 65 |
# File 'lib/mongo/operation/list_collections/result.rb', line 63 def documents cursor_document[FIRST_BATCH] end |
#namespace ⇒ String
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.
50 51 52 |
# File 'lib/mongo/operation/list_collections/result.rb', line 50 def namespace cursor_document ? cursor_document[NAMESPACE] : super end |
#validate! ⇒ 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.
Validate the result. In the case where an unauthorized client tries to run the command we need to generate the proper error.
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/mongo/operation/list_collections/result.rb', line 76 def validate! if successful? self else raise Error::OperationFailure.new( parser., self, code: parser.code, code_name: parser.code_name, labels: parser.labels, wtimeout: parser.wtimeout) end end |