Module: Mongoid::Criteria::Queryable
- Includes:
- Aggregable, Mergeable, Optional, Selectable
- Included in:
- Mongoid::Criteria
- Defined in:
- lib/mongoid/criteria/queryable.rb,
lib/mongoid/criteria/queryable/key.rb,
lib/mongoid/criteria/queryable/smash.rb,
lib/mongoid/criteria/queryable/options.rb,
lib/mongoid/criteria/queryable/optional.rb,
lib/mongoid/criteria/queryable/pipeline.rb,
lib/mongoid/criteria/queryable/selector.rb,
lib/mongoid/criteria/queryable/macroable.rb,
lib/mongoid/criteria/queryable/mergeable.rb,
lib/mongoid/criteria/queryable/aggregable.rb,
lib/mongoid/criteria/queryable/selectable.rb,
lib/mongoid/criteria/queryable/forwardable.rb,
lib/mongoid/criteria/queryable/extensions/set.rb,
lib/mongoid/criteria/queryable/extensions/date.rb,
lib/mongoid/criteria/queryable/extensions/hash.rb,
lib/mongoid/criteria/queryable/extensions/time.rb,
lib/mongoid/criteria/queryable/extensions/array.rb,
lib/mongoid/criteria/queryable/extensions/range.rb,
lib/mongoid/criteria/queryable/extensions/object.rb,
lib/mongoid/criteria/queryable/extensions/regexp.rb,
lib/mongoid/criteria/queryable/extensions/string.rb,
lib/mongoid/criteria/queryable/extensions/symbol.rb,
lib/mongoid/criteria/queryable/extensions/boolean.rb,
lib/mongoid/criteria/queryable/extensions/numeric.rb,
lib/mongoid/criteria/queryable/extensions/date_time.rb,
lib/mongoid/criteria/queryable/extensions/nil_class.rb,
lib/mongoid/criteria/queryable/extensions/big_decimal.rb,
lib/mongoid/criteria/queryable/extensions/time_with_zone.rb
Overview
A queryable is any object that needs queryable’s dsl injected into it to build MongoDB queries. For example, a Mongoid::Criteria is an Queryable.
Defined Under Namespace
Modules: Aggregable, Extensions, Forwardable, Macroable, Mergeable, Optional, Selectable Classes: Key, Options, Pipeline, Selector, Smash
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
- #aliases The aliases.(Thealiases.) ⇒ Object readonly
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
- #driver The Mongo driver being used.(TheMongodriverbeingused.) ⇒ Object readonly
-
#serializers ⇒ Object
readonly
Returns the value of attribute serializers.
- #serializers The serializers.(Theserializers.) ⇒ Object readonly
Attributes included from Optional
#options, #options The query options.
Attributes included from Aggregable
#aggregating, #aggregating Flag for whether or not we are aggregating., #pipeline, #pipeline The aggregation pipeline.
Attributes included from Mergeable
#strategy, #strategy The name of the current strategy.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Is this queryable equal to another object? Is true if the selector and options are equal.
-
#initialize(aliases = {}, serializers = {}, driver = :mongo) {|_self| ... } ⇒ Object
Initialize the new queryable.
-
#initialize_copy(other) ⇒ Object
Handle the creation of a copy via #clone or #dup.
Methods included from Optional
#ascending, #batch_size, #comment, #cursor_type, #descending, forwardables, #hint, #limit, #max_scan, #max_time_ms, #no_timeout, #only, #order_by, #reorder, #skip, #slice, #snapshot, #without
Methods included from Macroable
Methods included from Selectable
Methods included from Aggregable
#aggregating?, #group, #project, #unwind
Methods included from Mergeable
#intersect, #override, #reset_strategies!, #union
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
34 35 36 |
# File 'lib/mongoid/criteria/queryable.rb', line 34 def aliases @aliases end |
#aliases The aliases.(Thealiases.) ⇒ Object (readonly)
34 |
# File 'lib/mongoid/criteria/queryable.rb', line 34 attr_reader :aliases, :driver, :serializers |
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
34 35 36 |
# File 'lib/mongoid/criteria/queryable.rb', line 34 def driver @driver end |
#driver The Mongo driver being used.(TheMongodriverbeingused.) ⇒ Object (readonly)
34 |
# File 'lib/mongoid/criteria/queryable.rb', line 34 attr_reader :aliases, :driver, :serializers |
#serializers ⇒ Object (readonly)
Returns the value of attribute serializers.
34 35 36 |
# File 'lib/mongoid/criteria/queryable.rb', line 34 def serializers @serializers end |
#serializers The serializers.(Theserializers.) ⇒ Object (readonly)
34 |
# File 'lib/mongoid/criteria/queryable.rb', line 34 attr_reader :aliases, :driver, :serializers |
Instance Method Details
#==(other) ⇒ true, false
Is this queryable equal to another object? Is true if the selector and options are equal.
47 48 49 50 |
# File 'lib/mongoid/criteria/queryable.rb', line 47 def ==(other) return false unless other.is_a?(Queryable) selector == other.selector && == other. end |
#initialize(aliases = {}, serializers = {}, driver = :mongo) {|_self| ... } ⇒ Object
Initialize the new queryable. Will yield itself to the block if a block is provided for objects that need additional behaviour.
63 64 65 66 67 68 69 |
# File 'lib/mongoid/criteria/queryable.rb', line 63 def initialize(aliases = {}, serializers = {}, driver = :mongo) @aliases, @driver, @serializers = aliases, driver.to_sym, serializers @options = Options.new(aliases, serializers) @selector = Selector.new(aliases, serializers) @pipeline = Pipeline.new(aliases) yield(self) if block_given? end |
#initialize_copy(other) ⇒ Object
Handle the creation of a copy via #clone or #dup.
79 80 81 82 83 |
# File 'lib/mongoid/criteria/queryable.rb', line 79 def initialize_copy(other) @options = other..__deep_copy__ @selector = other.selector.__deep_copy__ @pipeline = other.pipeline.__deep_copy__ end |