Hi, I am kind of new to PayloadCMS but I struggle to find any resources on, how to send a proper create post for a collection with a relationship, to create both collections at the same time.
Is this even possible?
If I try to send a request with the relationship field in the body having an object as value (containing keys and values that are required as defined in my collection). It just gives me the following error:
"This field has the following invalid selections: [object Object] 0"
Some help on this and maybe some resources would be great!
Currently there is not a way to create 2 documents in one request. You'll need to create the first make sure the collection that is being related to is made, then create the parent document with the relationship field populated using the
id
of the first document.
This would be a good feature request if you want to ask for it on our Github in a new discussion.
Thanks
Star
Discord
online
Get dedicated engineering support directly from the Payload team.