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

Is there an easy way of clearing unwanted published items?

5 replies
Last updated: Oct 30, 2020

HI I have published once but my data shows an array?

"result":[2 items
0:{6 items
"_createdAt":"2020-10-30T07:44:59Z"
"_id":"932ebb41-cf8d-463d-9ad9-6e4c88588b54"
"_rev":"XNtMa4Y66vmVFnyOJAoV3C"
"_type":"siteSettings"
"_updatedAt":"2020-10-30T08:08:55Z"
"owner":{4 items
"facebook":"@facebook"
"instagram":"@instagram"
"name":"Amy Robers"
"twitter":"@twitter"
}
}
1:{8 items
"_createdAt":"2020-10-30T11:51:03Z"
"_id":"siteSettings"
"_rev":"XNtMa4Y66vmVFnyOJEK8AQ"
"_type":"siteSettings"
"_updatedAt":"2020-10-30T15:53:17Z"
"name":"Amy"
"person":{3 items
"facebook":"<https://yourfacebookurl/>"
"instagram":"<https://yourinstagramurl/>"
"twitter":"<https://yourtwitterurl/>"
}
"website":"<http://yogawithamy.com|yogawithamy.com>"
}
]
How can I clear that first array? Thanks

Oct 30, 2020, 3:56 PM

Looks like you’re querying

_type == "siteSettings"
and you’ve published several siteSettings documents already. Try
*[_id == "siteSettings"][0]
instead

Oct 30, 2020, 4:06 PM

Thanks! Is there an easy way of clearing unwanted published items?

Oct 30, 2020, 4:08 PM

Hi James, you could run

sanity documents delete &lt;id&gt;
to delete a single document.

Oct 30, 2020, 5:01 PM

Hi James, you could run

sanity documents delete &lt;id&gt;
to delete a single document.

Oct 30, 2020, 5:01 PM

Thanks for the help . Much appreciated. Command line did the trick ⛑️

Oct 30, 2020, 11:43 PM

Sanity.io: Get the most out of your content

Sanity.io 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. Sanity.io 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 Sanity.io. Free to get started, pay-as-you-go on all plans.