Auto-populating array of references to child documents in Sanity

1 replies
Last updated: Apr 16, 2020
Hi, i have two documents. One document is a parent and the other is children of the first. In the parent document i want an array with all the referances to the children to be auto populated when new children is created. This is so that the end user can sort the documents in what ever order they see fit but also so that they wont have to manually add all the children manualy. Is this possible and/or is there any other way for the enduser to sort a list in whatever way they want? 🙂
Apr 16, 2020, 7:19 PM
I did something like this. You can use the query listeners: https://www.sanity.io/docs/listening and then do a "patch" https://www.sanity.io/docs/http-patches
Apr 16, 2020, 9:28 PM

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?