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

Deprecate/remove :symbol.in syntax

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Query
    • Labels:
      None

      Currently Mongoid monkey patches symbol with `#in`, `#lt`, `#elem_match`, etc.

      As an example:

      Customers.where(:name.in => ["Bob", "David"])

      Mongoid also provides two other equivalent ways of doing this:

      Customers.any_in(name: ["Bob", "David"])
      Customers.where(name:

      { "$in" => ["Bob", "David"] }

      )

      I think it is not good to monkey patch a kernel object like Symbol. This could be extracted out to a gem for users who want to keep it, but it should not be in Mongoid core.

      Propose to deprecate with warning in Mongoid 7.2 and remove entirely in Mongoid 8.0.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: