Unlock seamless workflows and faster delivery with our latest releases – get the details

How to View and Delete Dangling Data

5 replies
Last updated: Jun 14, 2021
Hey, I decided to do some Sanity spring cleaning and removed some schemas before removing all the documents. Now I have a document that can't delete. I tried reverting to an old commit, starting up Sanity locally, but that lead to a different error.
Ideally, I would be able to see all my data that is dangling, without any references, and delete them?
Jun 11, 2021, 4:47 PM
If so, you can take the
_id
from the URL (if your URL is
<http://localhost:3333/desk/post;031061f3-0d34-4bg2-a34c-92f1a53e5dde>
, the
_id
is
031061f3-0d34-4bg2-a34c-92f1a53e5dde
) and then run this command in your terminal:

sanity documents delete "031061f3-0d34-4bg2-a34c-92f1a53e5dde"
You might also need to run this command if there’s a draft kicking around:


sanity documents delete "drafts.031061f3-0d34-4bg2-a34c-92f1a53e5dde"
Jun 11, 2021, 5:30 PM
If so, you can take the
_id
from the URL (if your URL is
<http://localhost:3333/desk/post;031061f3-0d34-4bg2-a34c-92f1a53e5dde>
, the
_id
is
031061f3-0d34-4bg2-a34c-92f1a53e5dde
) and then run this command in your terminal:

sanity documents delete "031061f3-0d34-4bg2-a34c-92f1a53e5dde"
You might also need to run this command if there’s a draft kicking around:


sanity documents delete "drafts.031061f3-0d34-4bg2-a34c-92f1a53e5dde"
Jun 11, 2021, 5:30 PM
user A
thanks, that fixed it!
Jun 14, 2021, 10:17 AM
Great! 🙌
Jun 14, 2021, 2:02 PM
Loving Sanity, great product!
Jun 14, 2021, 2:03 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?