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

Produce the same query shapes with Criteria#where and Criteria#and

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.1.0.rc0
    • Affects Version/s: None
    • Component/s: Query
    • None

      Following 4697 where and and function identically but produce different query shapes:

      irb(main):001:0> Band.where(name: 1).where(name: 2).selector
      => {"$and"=>[{"name"=>"1"}], "name"=>"2"}
      irb(main):002:0> Band.where(name: 1).and(name: 2).selector
      => {"name"=>"1", "$and"=>[{"name"=>"2"}]}
      

      This ticket is to make them produce the same query shape, which should also be consistent with what or produces if possible.

            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: