Class: Mongo::Database::CursorCommandView Private
- Inherits:
-
Object
- Object
- Mongo::Database::CursorCommandView
- Defined in:
- lib/mongo/database/cursor_command_view.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.
The minimal view a Cursor needs when it is built from an arbitrary command response rather than from a collection query.
It carries the getMore-specific options (batchSize, maxTimeMS, comment) and the cursor type and timeout mode, and answers the few methods the Cursor reads from its view.
Instance Attribute Summary collapse
-
#database ⇒ Mongo::Database
readonly
private
The database the command ran on.
-
#options ⇒ Hash
readonly
private
The view options.
Instance Method Summary collapse
-
#batch_size ⇒ Integer | nil
private
The batchSize sent on getMore commands.
-
#client ⇒ Mongo::Client
private
The client.
-
#collection ⇒ Mongo::Collection
private
A placeholder collection used only so the Cursor can reach the client and database.
-
#cursor_type ⇒ Symbol | nil
private
The cursor type.
-
#initialize(database, options = {}) ⇒ CursorCommandView
constructor
private
A new instance of CursorCommandView.
-
#limit ⇒ Object
private
Cursors do not support a limit when built from a command response.
-
#max_time_ms_for_get_more ⇒ Integer | nil
private
The maxTimeMS sent on getMore commands.
-
#operation_timeouts(opts = {}) ⇒ Hash
private
Timeout values for the operation context.
-
#timeout_mode ⇒ Symbol | nil
private
The timeout mode.
Constructor Details
#initialize(database, options = {}) ⇒ CursorCommandView
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 a new instance of CursorCommandView.
36 37 38 39 |
# File 'lib/mongo/database/cursor_command_view.rb', line 36 def initialize(database, = {}) @database = database @options = end |
Instance Attribute Details
#database ⇒ Mongo::Database (readonly)
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 database the command ran on.
42 43 44 |
# File 'lib/mongo/database/cursor_command_view.rb', line 42 def database @database end |
#options ⇒ Hash (readonly)
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 view options. Used by the Cursor to read the getMore comment.
46 47 48 |
# File 'lib/mongo/database/cursor_command_view.rb', line 46 def @options end |
Instance Method Details
#batch_size ⇒ 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 batchSize sent on getMore commands.
63 64 65 |
# File 'lib/mongo/database/cursor_command_view.rb', line 63 def batch_size [:batch_size] end |
#client ⇒ Mongo::Client
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 client.
49 50 51 |
# File 'lib/mongo/database/cursor_command_view.rb', line 49 def client database.client end |
#collection ⇒ Mongo::Collection
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.
A placeholder collection used only so the Cursor can reach the client and database. The actual namespace for getMore and killCursors is taken from the command response, not from this collection.
58 59 60 |
# File 'lib/mongo/database/cursor_command_view.rb', line 58 def collection @collection ||= Collection.new(database, '$cmd') end |
#cursor_type ⇒ Symbol | 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 type.
73 74 75 |
# File 'lib/mongo/database/cursor_command_view.rb', line 73 def cursor_type [:cursor_type] end |
#limit ⇒ Object
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.
Cursors do not support a limit when built from a command response.
90 91 92 |
# File 'lib/mongo/database/cursor_command_view.rb', line 90 def limit nil end |
#max_time_ms_for_get_more ⇒ 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 maxTimeMS sent on getMore commands.
68 69 70 |
# File 'lib/mongo/database/cursor_command_view.rb', line 68 def max_time_ms_for_get_more [:max_time_ms] end |
#operation_timeouts(opts = {}) ⇒ Hash
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 timeout values for the operation context.
83 84 85 |
# File 'lib/mongo/database/cursor_command_view.rb', line 83 def operation_timeouts(opts = {}) database.operation_timeouts(opts) end |
#timeout_mode ⇒ Symbol | 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 timeout mode.
78 79 80 |
# File 'lib/mongo/database/cursor_command_view.rb', line 78 def timeout_mode [:timeout_mode] end |