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

Criteria#not ignores all but first argument

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

      Like and/or/nor, not's signature accepts any number of arguments, but only the first one is actually processed:

      irb(main):037:0> Band.not(a:1)
      => #<Mongoid::Criteria
        selector: {"a"=>{"$not"=>1}}
        options:  {}
        class:    Band
        embedded: false>
      
      irb(main):038:0> Band.not(a:1, b:2)
      => #<Mongoid::Criteria
        selector: {"a"=>{"$not"=>1}, "b"=>{"$not"=>2}}
        options:  {}
        class:    Band
        embedded: false>
      
      irb(main):039:0> Band.not({a:1}, {b:2})
      => #<Mongoid::Criteria
        selector: {"a"=>{"$not"=>1}}
        options:  {}
        class:    Band
        embedded: false>
      
      irb(main):040:0> Band.or({a:1}, {b:2})
      => #<Mongoid::Criteria
        selector: {"$or"=>[{"a"=>1}, {"b"=>2}]}
        options:  {}
        class:    Band
        embedded: false>
      

            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: