-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query
-
Fully Compatible
If I define a default scope and then use Model.or, the default scope becomes one of the disjunction branches instead of being a top-level condition in addition to whatever was given in the or:
class Band include Mongoid::Document default_scope -> { where(likes: 2) } end irb(main):001:0> Band.or(likes:3) => #<Mongoid::Criteria selector: {"$or"=>[{"likes"=>2}, {"likes"=>3}]} options: {} class: Band embedded: false>
This also affects nor the same way.
When this ticket is worked on, "current scope" set with with_scope should be tested in addition to the defaut scope, as well as clearing scopes with unscoped.
- is related to
-
MONGOID-5454 Separate default scope from other query conditions
- Backlog
- related to
-
MONGOID-5186 .with_scope should restore previous scope
- Closed
-
MONGOID-5229 Add Feature Flag: .with_scope should restore previous scope
- Closed
- links to