Mongoid::Criteria::Queryable::Selector#merge! does not correctly merge $in and $nin when provided as a symbol as well as a string.
selector = Mongoid::Criteria::Queryable::Selector.new selector['field'] = { :$in => [1,2] } selector.merge!( 'field' => { :$in => [3] }) selector # => {"field"=>{:$in=>[3]}}, while it should be {"field"=>{:$in=>[]}}
Issue was introduced with PR-4645.
Behaviour before allowed $in and $nin to be provided as symbols or strings and would match correctly.
After PR-4645 only $in or $nin strings would be merged.