-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query
-
None
Rails 6.1 introduced the following behavior in ActiveRecord:
Avoid making query when using `where(attr: [])`
https://github.com/rails/rails/pull/37266
Mongoid should implement something similar. For example, the following queries are guaranteed never to return any results:
Users.any_in(name: [])
Users.where(name: 'Bob').where(name: 'Joe')
Such code should return a Mongoid::Criteria but calling .to_a on that criteria returns [] without generating a DB query.
- is depended on by
-
MONGOID-5309 Remove deprecated Object#blank_criteria? method
- Blocked
- related to
-
SERVER-79088 Improve SBE multi-planner performance for query which returns zero results
- Closed