🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Behavior difference between Sanity client and vision tool when referencing documents with a modified _id.

4 replies
Last updated: Apr 22, 2024
Hello all, question regarding the _id of documents. We recently did a migration in sanity and decided we wanted to be able to know the “old” _id by making the new document id be
. This works fine however if we reference these documents in a groq query we get results in the vision tool (any setting really) but if we use the sanity client it will return null?!
Apr 22, 2024, 2:20 PM
We managed to resolve the situation by migrating again but this time use
curious why the client is behaving differently to the vision tool though (and is there some arbitrary check for a dot that caused this behaviour?).
Apr 22, 2024, 2:46 PM
By adding a prefix with a
, you’re creating a non-root path for that document. That means that they’re not considered public and require a token in order to be queried.
Apr 22, 2024, 6:06 PM
Ahhh so silly should have read up on that, thanks for the clarification
user M
Apr 22, 2024, 6:07 PM
It’s a super easy thing to miss!
Apr 22, 2024, 6:09 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?