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.

Cast to ObjectID Failed

default discord avatar
zinox92 years ago
5

Hi, am getting this error, I want to render the projects that are in the users field. Can't find what am doing wrong.

  • default discord avatar
    .bakry2 years ago

    it seems like you are passing a whole object instead of ID i believe

  • default discord avatar
    zinox92 years ago

    Thats how it was built in this demo 🤔



    Anyone ?



    Gotta solve this urgently anyone there to help ?

  • default discord avatar
    derosul2 years ago

    Hmm, that's weird. idk if the demo is still up to date in that case?


    As

    @281291275615862795

    mentioned, seems like its trying to cast the entire object to an ObjectID. can you try to just pass in an array of object Id's? 🤔



    so instead of



    in: user.projects


    Try something like



    in: user.projects.map((project) => project.id)
  • default discord avatar
    zinox92 years ago

    Got it



    yep thats working

  • default discord avatar
    derosul2 years ago

    Nice!

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.