Method: Mongo::Database::View#initialize

Defined in:
lib/mongo/database/view.rb

#initialize(database, options = {}) ⇒ View

Create the new database view.

Examples:

Create the new database view.

Database::View.new(database)

Options Hash (options):

  • :timeout_mode (:cursor_lifetime | :iteration)

    How to interpret :timeout_ms (whether it applies to the lifetime of the cursor, or per iteration).

  • :timeout_ms (Integer)

    The operation timeout in milliseconds. Must be a non-negative integer. An explicit value of 0 means infinite. The default value is unset which means the value is inherited from the database or the client.

Since:

  • 2.0.0



151
152
153
154
155
156
157
158
159
160
# File 'lib/mongo/database/view.rb', line 151

def initialize(database, options = {})
  @database = database
  @operation_timeout_ms = options.delete(:timeout_ms)

  validate_timeout_mode!(options)

  @batch_size =  nil
  @limit = nil
  @collection = @database[Database::COMMAND]
end