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

Make any_of behave like or but not disjunct the receiver

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

      Per the discussion in https://jira.mongodb.org/browse/MONGOID-4860, it is indeed somewhat awkward to write:

      Foo.and(Foo.or(condition1, condition2))
      

      We should investigate repurposing any_of to achieve this without the and, as follows:

      Foo.any_of(condition1, condition2)
      

      Such that the following expresses that condition 1 must be true or either of conditions 2 and 3 must be true:

      Foo.where(condition1).any_of(condition2, condition3)
      

      If Mongoid 7.0 behaves in this manner, I think it would be helpful for Mongoid 7.1.1 to reinstate this behavior of any_of, and leave `or` behave as it currently does in 7.1.0.

            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: