Behavior — Documentation by YARD 0.9.37 (original) (raw)

Module: Mongo::Collection::View::Aggregation::Behavior

Overview

Distills the behavior common to aggregator classes, like View::Aggregator and View::ChangeStream.

Constant Summary

Constants included from Loggable

Loggable::PREFIX

Constants included from Explainable

Explainable::ALL_PLANS_EXECUTION, Explainable::EXECUTION_STATS, Explainable::QUERY_PLANNER

Instance Attribute Summary collapse

Attributes included from Mongo::CursorHost

#cursor, #timeout_mode

Attributes included from Immutable

#options

Instance Method Summarycollapse

Methods included from Retryable

#read_worker, #select_server, #write_worker

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Methods included from Iterable

#close_query, #each

Methods included from Mongo::CursorHost

#validate_timeout_mode!

Instance Attribute Details

#viewView

Returns view The collection view.

19 20 21 # File 'lib/mongo/collection/view/aggregation/behavior.rb', line 19 def view @view end

Instance Method Details

#allow_disk_use(value = nil) ⇒ true, ...

Set to true if disk usage is allowed during the aggregation.

38 39 40 # File 'lib/mongo/collection/view/aggregation/behavior.rb', line 38 def allow_disk_use(value = nil) configure(:allow_disk_use, value) end

#explain ⇒ Hash

Get the explain plan for the aggregation.

50 51 52 # File 'lib/mongo/collection/view/aggregation/behavior.rb', line 50 def explain self.class.new(view, pipeline, options.merge(explain: true)).first end

#timeout_ms ⇒ 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 timeout_ms value that was passed as an option to this object, or which was inherited from the view.

| 68 69 70 | # File 'lib/mongo/collection/view/aggregation/behavior.rb', line 68 def timeout_ms @timeout_ms || view.timeout_ms end | | -------- | ---------------------------------------------------------------------------------------------------------------------------- |

#write? ⇒ Boolean

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.

Whether this aggregation will write its result to a database collection.

| 60 61 62 | # File 'lib/mongo/collection/view/aggregation/behavior.rb', line 60 def write? pipeline.any? { |op| op.key?('$out') | | op.key?(:$out) | | op.key?('$merge') | | op.key?(:$merge) } end | | -------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------- | ------------------- | ------------------------ |