Skip to content

Questions regarding creating/updating a collection using payload local API. #309

Answered by DanRibbens
fabcodingzest asked this question in Q&A
Discussion options

You must be logged in to vote

I have few situations where I have a relationship field with and without hasMany set to true, now when I want to use payload API to create/update the collection, I pass the id from the data I got, but it throws an error regarding ObjectId. I understand that it is asking for objectId when I am passing the id string (maybe) that I got from data.id (which is supposed to be objectId right?).

Formatting the relationship object can be a little confusing, we added to the documentation to help https://payloadcms.com/docs/fields/relationship#how-the-data-is-saved. Have you seen that yet?

I wanted to know if there is any way of updating the collection where we have a relationship field (single o…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fabcodingzest
Comment options

Answer selected by fabcodingzest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants