Module: Mongoid::Criteria::Queryable::Mergeable

Included in:
Mongoid::Criteria::Queryable
Defined in:
lib/mongoid/criteria/queryable/mergeable.rb

Overview

Contains behaviour for merging existing selection with new selection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#strategyObject

Returns the value of attribute strategy



10
11
12
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 10

def strategy
  @strategy
end

#strategy The name of the current strategy.(Thenameofthecurrentstrategy.) ⇒ Object



10
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 10

attr_accessor :strategy

Instance Method Details

#intersectMergeable

Instruct the next mergeable call to use intersection.

Examples:

Use intersection on the next call.

mergeable.intersect.in(field: [ 1, 2, 3 ])

Returns:

  • (Mergeable)

    The intersect flagged mergeable.

Since:

  • 1.0.0



20
21
22
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 20

def intersect
  use(:__intersect__)
end

#overrideMergeable

Instruct the next mergeable call to use override.

Examples:

Use override on the next call.

mergeable.override.in(field: [ 1, 2, 3 ])

Returns:

  • (Mergeable)

    The override flagged mergeable.

Since:

  • 1.0.0



32
33
34
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 32

def override
  use(:__override__)
end

#reset_strategies!nil

Reset the stratgies to nil, used after cloning.

Examples:

Reset the strategies.

mergeable.reset_strategies!

Returns:

  • (nil)

    nil.

Since:

  • 1.0.0



56
57
58
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 56

def reset_strategies!
  self.strategy, self.negating = nil, nil
end

#unionMergeable

Instruct the next mergeable call to use union.

Examples:

Use union on the next call.

mergeable.union.in(field: [ 1, 2, 3 ])

Returns:

  • (Mergeable)

    The union flagged mergeable.

Since:

  • 1.0.0



44
45
46
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 44

def union
  use(:__union__)
end