-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Minor Change
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.
- is cloned by
-
MONGOID-5233 Add Feature Flag: Respect aliased fields in pluck/distinct by having Document.database_field_name recursively consider embedded docs
- Closed
- is duplicated by
-
MONGOID-5152 database_field_name should work with embedded fields
- Closed
-
MONGOID-5156 Mongoid::Document.database_field_name should handle embedded doc store_as and field aliases
- Closed
- links to