.any_in doesn't handle nil

XMLWordPrintableJSON

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

      Testing against 2.4.11

      This works:

      MyModel.where(foo_id: nil)
      

      But this doesn't work (it only captures documents where foo_id was not nil):

      MyModel.any_in(foo_id: [nil,Foo.first.id])
      

      This also doesn't work (it captures no documents):

      MyModel.any_in(foo_id: [nil])
      

      But equivalent queries run directly against MongoDB do work:

      db.my_models.find({foo_id: { $in : [null] }})
      db.my_models.find({foo_id: { $in : [null,ObjectId("4fcfa5d0202cb17b63000003")] }})
      

      The criteria_spec also doesn't handle the case where nil is passed to any_in

            Assignee:
            Durran Jordan
            Reporter:
            veesahni
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: