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

not creates incorrect queries when symbol operators are given

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.1.2
    • Component/s: Query
    • Labels:
      None

      Description

      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>
      
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              oleg.pudeyev Oleg Pudeyev
              Reporter:
              oleg.pudeyev Oleg Pudeyev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: