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

:some_attribute.ne => '' gets converted to "$ne"=>nil

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.1.3
    • Affects Version/s: None
    • Component/s: None

      If a blank string is passed to a 'ne' query, the blank string is converted to nil.
      <pre>
      <code>
      Product.where(:some_attribute.ne => '' )

      becomes

      find({:deleted_at=>

      {"$exists"=>false}

      , :some_attribute=>{"$ne"=>nil}})

      </code>
      </pre>

      which return records whose :some_attribute is ''.

            Assignee:
            Unassigned Unassigned
            Reporter:
            computadude Mark Ronai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: