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 for value

default discord avatar
sburgpitlast year

I get this error when I try to open the relationship field after I added data there programmatically.



Steps:


1. I added a new row to the array using dispatchField (Screenshot 1)


2. The ID is successfully passed to the row (Screenshot 2)


3. Payload successfully receives data by id (Screenshot 3)


4. I am trying to edit the relationship field manually and get an error Cast to ObjectId failed for value. I see that the id is not transmitted when the payload tries to load the data of other items (Screenshot 4)


5. This is what the relationship field looks like (Screenshot 5)



The problem was solved by switching to version 1.12.0 using a new method for working with arrays.

    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.