-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
The values for index specification options, for example partial_filter_expression, could contain field names. Mongoid permits a user to specify that a field in their model should be stored as another field on the server(https://www.mongodb.com/docs/mongoid/master/reference/fields/#specifying-storage-field-names); this expansion is not currently performed for index specification option values but it should be.
------
Original report:
Tested on Mongoid 7.4.0
A partial_filter_expression with an aliased field does not work.
class Person include Mongoid::Document field :n, as: :name, type: String # BROKEN index({ name: 1 }, { partial_filter_expression: { name: { '$exists' => true } } }) # works correctly index({ name: 1 }, { partial_filter_expression: { n: { '$exists' => true } } }) end
- is related to
-
MONGOID-5021 index macro does not expand HABTM associations
- Backlog
-
MONGOID-5338 Document missing index declaration options including partial_filter_expression
- Backlog
-
MONGOID-5339 Document whether index declaration accounts for storage field names
- Backlog