Join our next Developer Virtual Meetup – Live Q&A, Project Showcase, Swag raffle, and more 🔥

How to delete all docs of a specific doc type via cli?

3 replies
Last updated: Nov 13, 2020
Hi all, just ran an import, there's some issues with some of the data so I need to delete all docs of a specific doc type... any ideas via cli?
Nov 11, 2020, 2:58 PM
sanityClient.delete({
  query: `*[_type == "post"]`
})
Nov 11, 2020, 3:40 PM
And allow read/write access to your token
Nov 11, 2020, 3:41 PM
Thanks for the tip!
Nov 13, 2020, 12:58 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?