Cannot add index for locale path #14027
Replies: 4 comments
-
Assuming I also noticed perhaps getFieldByPath.ts#L36 should break out of the while loop instead of returning |
Beta Was this translation helpful? Give feedback.
-
I think this could be useful, though it can be supported only in MongoDB and not Postgres. I'm converting this to a discussion since it's not a bug but a feature request. In the meantime you can either just use
It is a valid path in the Mongoose schema but not in the Payload schema, this function operates on Payload fields. |
Beta Was this translation helpful? Give feedback.
-
The documentation I referenced (https://payloadcms.com/docs/database/indexes#localized-fields-and-mongodb-indexes) was added to address #13464 (i.e. #13469). Since it is in the official documentation, one would assume it is supported (not a feature request). If it is not supported then it should be removed from the documentation (and #13464 reopened). |
Beta Was this translation helpful? Give feedback.
-
I have opened #14071 to fix the documentation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the Bug
When I try to add an index for a locale path using the collection-level
indexes
option (as described in https://payloadcms.com/docs/database/indexes#localized-fields-and-mongodb-indexes), I get an error saying the field was not found:I wanted to set this index because I want to sort by the English field value, but do not want multiple indexes for every locale (#13464).
Link to the code that reproduces this issue
https://github.com/jefferyto/payload-index-locale-path
Reproduction Steps
indexes
option with a locale path for the localized field, e.g.:Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Beta Was this translation helpful? Give feedback.
All reactions