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

Omit $or operator when it has only one condition

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Query

      or() with a single argument should simply place that argument as the top level condition, not nested under $or.

      Current behavior:

      irb(main):009:0> Band.or(year: 1)
      => 
      #<Mongoid::Criteria
        selector: {"$or"=>[{"year"=>1}]}
        options:  {}
        class:    Band
        embedded: false>
      
      

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

              Created:
              Updated: