👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

How to Auto Populate References in Parent Document when New Children are Created

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 remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?