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
vpjm2 years ago
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
    mrbanana1662 years ago

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

  • default discord avatar
    notchr2 years ago

    ^ This is true



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

  • default discord avatar
    vpjm2 years ago

    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.