Join us live Sept. 27 – How Sanity and Vercel powered Morning Brew's transformation –>

Example of updating a deeply nested document with @sanity/client ?

2 replies
Last updated: Sep 12, 2020

hi would anyone have a example of updating a deeply nested document with

? the kind of stuff you find there but for objects nested 2 or 3 levels down?

Sep 11, 2020, 11:19 PM

I guess we should improve our docs here, but you can do

client.patch(_id).set({'': 'new-value'}).commit()
You can also do it in a transaction like this:

Sep 12, 2020, 7:50 AM

awesome thanks

Sep 12, 2020, 7:54 AM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Free to get started, pay-as-you-go on all plans.