Bit of a weird one -- been debugging some performance issues with Payload and have noticed some of the indexes we defined on a field haven't been working
This doesn't seem to be happening consistently across our application, for example this field did not have an index:
{
name: 'externalId',
label: 'External ID',
type: 'text',
access: {
read: adminOnly,
update: () => false
},
index: true,
unique: true
},
Other similar fields have had an index though, for example this slug index:
{
name: 'slug',
type: 'text',
label: 'Slug',
index: true,
unique: true,
admin: {
description:
'The unique identifier for this page. This will be used in the URL.',
position: 'sidebar'
},
Anyone got any insights to this?
Running
const members = payload.collections['members'].Model
await members.syncIndexes()
creates the index
Hey, @devperson! Have you applied
index: true
after collection items was created? If yes, this might be the issue, AFAIK.
Ah yeah, good to know
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.