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

Add Feature Flag: Respect aliased fields in pluck/distinct by having Document.database_field_name recursively consider embedded docs

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 7.4.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible

      Per https://github.com/mongodb/mongoid/pull/5047, the user-visible change is that pluck and distinct methods will now respect field aliases.


      Currently, database_field_name only works for fields specified without a period delimiter.

      If I have embedded docs with "store_as" and field aliases, then this:

      Person.database_field_name("phones.country_code.iso_alpha2_code")

      should return as it is stored in DB, for example:

      "phs.cc.iso"

      This change will not break any existing used functionality of database_field_name, it just makes it work correctly in more cases.

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: