Module: Mongoid::Criteria::Queryable
- Includes:
- Aggregable, Expandable, Mergeable, Optional, Storable, Selectable
- Included in:
- Mongoid::Criteria
- Defined in:
- build/mongoid-8.1/lib/mongoid/criteria/queryable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/key.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/smash.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/options.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/optional.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/pipeline.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/selector.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/storable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/macroable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/mergeable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/aggregable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/expandable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/selectable.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/set.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/date.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/hash.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/time.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/array.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/range.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/object.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/regexp.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/string.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/symbol.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/boolean.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/numeric.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/date_time.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/nil_class.rb,
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/big_decimal.rb,
build/mongoid-8.1/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, Expandable, Extensions, Macroable, Mergeable, Optional, Selectable, Storable 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
-
#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 = {}, associations = {}, aliased_associations = {}) {|_self| ... } ⇒ Object
private
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, #collation, #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
#and_with_operator, #intersect, #override, #reset_strategies!, #union
Methods included from Storable
#add_field_expression, #add_logical_operator_expression, #add_one_expression, #add_operator_expression
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
36 37 38 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 36 def aliases @aliases end |
#aliases The aliases.(Thealiases.) ⇒ Object (readonly)
36 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 36 attr_reader :aliases |
#serializers ⇒ Object (readonly)
Returns the value of attribute serializers.
39 40 41 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 39 def serializers @serializers end |
#serializers The serializers.(Theserializers.) ⇒ Object (readonly)
39 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 39 attr_reader :serializers |
Instance Method Details
#==(other) ⇒ true | false
Is this queryable equal to another object? Is true if the selector and options are equal.
50 51 52 53 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 50 def ==(other) return false unless other.is_a?(Queryable) selector == other.selector && == other. end |
#initialize(aliases = {}, serializers = {}, associations = {}, aliased_associations = {}) {|_self| ... } ⇒ 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.
Initialize the new queryable. Will yield itself to the block if a block is provided for objects that need additional behavior.
68 69 70 71 72 73 74 75 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 68 def initialize(aliases = {}, serializers = {}, associations = {}, aliased_associations = {}) @aliases, @serializers = aliases, serializers @options = Options.new(aliases, serializers, associations, aliased_associations) @selector = Selector.new(aliases, serializers, associations, aliased_associations) @pipeline = Pipeline.new(aliases) @aggregating = nil yield(self) if block_given? end |
#initialize_copy(other) ⇒ Object
Handle the creation of a copy via #clone or #dup.
83 84 85 86 87 |
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable.rb', line 83 def initialize_copy(other) @options = other..__deep_copy__ @selector = other.selector.__deep_copy__ @pipeline = other.pipeline.__deep_copy__ end |