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

Cannot use any_of with multiple conditions when using symbol operators on Time fields and passing Date instances

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.1, 7.1.7
    • Affects Version/s: 7.1.5
    • Component/s: Query
    • Labels:
      None
    • Fully Compatible

      The following code raises NotImplementedError:

      Band.any_of(
        { a: 1 }, { :created_at.gte => Date.today}
      )
      

      The error is produced when:

      • Multiple conditions are given in the same invocation
      • Symbol operators are used (which are implemented using Key instances)
      • The value being given is evolved to a different value (e.g. the field being queried is a Time field and the value given is a Date instance)

      Operators other than any_of may be affected also, I didn't check. Whichever operators are affected should be fixed by the fix here.

      SO report: https://stackoverflow.com/questions/65324196/error-on-mongoid-query-with-any-of-and-conditions-on-a-same-attribute#comment115518196_65324196

            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: