Skip to content

Localized text field with index/unique creates one index per locale #13464

@marklonquist

Description

@marklonquist

Describe the Bug

I'm not sure if this is a bug, but currently, if you have a localized text field that is indexed, it creates one index per locale, which in MongoDB can fill up the available index space (only 64 indexes can be made)

It should be possible to index the field as is (not per locale). Example in code uses a "slug" field.

Eg, index on slug rather than the localized versions (eg, slug.da-dk), means that the query will have to be changed so it searched for { "slug": { "da-dk": "/da-dk/some/page/here" } }, instead of { "slug.da-dk": "/da-dk/some/page/here" }

Link to the code that reproduces this issue

https://github.com/marklonquist/payload/tree/too-many-indexes

Reproduction Steps

Setup a mongodb instance, setup the repository to use it, start up payload, and then check the amount of created indexes

Which area(s) are affected? (Select all that apply)

db-mongodb

Environment Info

I can't. Get this error:
'payload' is not recognized as an internal or external command,
operable program or batch file.
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "payload" not found

Did you mean "pnpm build:payload"?

However, I cloned the repository to make my reproduction

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions