Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4870

$or condition is mishandled by Criteria#where

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 7.1.1
    • Affects Version/s: None
    • Component/s: Query
    • None

      When an explicit $or is used with Criteria#where, the receiver is disjuncted as Criteria#or would operate:

      
      irb(main):008:0> Band.where(foo: 1).where('$or'=>[{hello:'world'}])
      => #<Mongoid::Criteria
        selector: {"$or"=>[{"foo"=>1}, {:hello=>"world"}]}
        options:  {}
        class:    Band
        embedded: false>
      
      
      

      What should happen is #where should always add conditions to the receiver.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: