Hi,
I have an endpoint that returns user information:
const user = await req.payload.findByID({
collection: 'user',
id: user_id,
showHiddenFields: true,
depth: 0
})
However, it keeps returning hidden fields.
The hidden fields in user collection :
{
type: 'group',
name: 'verif',
admin: { hidden: true, readOnly: true, },
fields: [
{ type: 'checkbox', name: 'verified', defaultValue: false, admin: { hidden: true } },
]
}
btw , i dont understand the difference between admin:{hidden:true} and just hidden:true
there is also all createdAt and stuff that i dont want to show in my result
thanks
I think hidden fields are only "hidden" from the UI, not from the actual data itself
^ This is true
However, you can author a custom endpoint to mirror your default ones and selectively return data
Star
Discord
online
Get dedicated engineering support directly from the Payload team.