Is this possible to add children when receiving post request with this kind of content:
http://localhost:3000/api/parent?depth=1
{
"name": "parent",
"child":{
"name": "child"
}
}
This would create child and parent object. Instead, I get child: null
in the answer
Hey @MattRvt — right now, this is not possible. It could be a a future feature that we build, but it'll take some new functionality to achieve. The way we'd do this currently is to first create the nested document, then pass the newly created document's ID to your parent doc.
So:
const parentDocData = {
"name": "parent",
"child": "6a3434543qw3derra" // ID of newly created child doc
}
Thank you for your reply. This feature would be awesome.
The same way, being able to create child through the UI from the parent page as it is done with array would be a great feature.
Again, many thanks for your work, your reply and the great documentation 🥳
You got it!
Actually we are definitely going to allow creating a child through the UI from the parent page. That's on the radar. Stay tuned!
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.