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

not creates incorrect queries when symbol operators are given

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.2
    • Affects Version/s: None
    • Component/s: Query
    • None

      When not is used with symbol operators, the resulting queries are incorrect:

      irb(main):001:0> Band.not(:age.gt => 3)
      => 
      #<Mongoid::Criteria
        selector: {"age"=>{"$ne"=>3}}
        options:  {}
        class:    Band
        embedded: false>
      
      

      Expected behavior:

      irb(main):001:0>  Band.not(:age.gt => 3)
      => 
      #<Mongoid::Criteria
        selector: {"$and"=>[{"$nor"=>[{"age"=>{"$gt"=>3}}]}]}
        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: