Class: Mongo::Operation::CursorCommand::Result Private
- Inherits:
-
Operation::Result
- Object
- Operation::Result
- Mongo::Operation::CursorCommand::Result
- Defined in:
- lib/mongo/operation/cursor_command/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.
Parses the cursor field of a command response so a Cursor can be built from the result. The parsing is identical to a find command result.
Instance Method Summary collapse
-
#cursor? ⇒ true | false
private
Whether the command response contained a cursor field.
-
#cursor_id ⇒ Integer | nil
private
The cursor id from the cursor document.
-
#documents ⇒ Array<BSON::Document>
private
The first batch of documents.
-
#namespace ⇒ String | nil
private
The cursor namespace, "database.collection".
Instance Method Details
#cursor? ⇒ true | false
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.
Returns Whether the command response contained a cursor field.
27 28 29 |
# File 'lib/mongo/operation/cursor_command/result.rb', line 27 def cursor? !cursor_document.nil? end |
#cursor_id ⇒ Integer | nil
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.
Returns The cursor id from the cursor document.
32 33 34 |
# File 'lib/mongo/operation/cursor_command/result.rb', line 32 def cursor_id cursor? ? 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.
Returns The first batch of documents.
37 38 39 |
# File 'lib/mongo/operation/cursor_command/result.rb', line 37 def documents cursor? ? cursor_document[FIRST_BATCH] : [] end |
#namespace ⇒ String | nil
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.
Returns The cursor namespace, "database.collection".
42 43 44 |
# File 'lib/mongo/operation/cursor_command/result.rb', line 42 def namespace cursor? ? cursor_document['ns'] : super end |