Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Hidden fields

default discord avatar
vpjmlast year
3

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

  • default discord avatar
    mrbanana166last year

    I think hidden fields are only "hidden" from the UI, not from the actual data itself

  • default discord avatar
    notchrlast year

    ^ This is true



    However, you can author a custom endpoint to mirror your default ones and selectively return data

  • default discord avatar
    vpjmlast year

    thanks

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.