Trouble querying for types and limitations of querying objects in Sanity
I've seen this issue before! When Vision shows no results for *[_type == 'testimonial'] but you know the type exists in your data, it's almost always one of these causes:
1. Dataset mismatch - This is the most common culprit. Check that Vision is querying the same dataset where your testimonials actually exist. Look at the dataset dropdown in Vision's interface (usually in the top toolbar). If you're using a production dataset but Vision is set to development (or vice versa), you won't see any results. Switch to the correct dataset and try again.
2. API version perspective - The Vision tool uses your authenticated credentials, which means you can see drafts and unpublished content. However, if your testimonials only exist as drafts and you're somehow querying with a published perspective filter, they might not appear. Try:
*[_type == 'testimonial'] | order(_updatedAt desc)And check if you see draft IDs (they start with drafts.).
3. Authentication context - Vision uses your logged-in Studio credentials, so it should see everything in your current project/dataset. But if the documents are somehow in a different project entirely, that would explain the disconnect.
Quick debugging steps:
- Try
*[_type == 'testimonial'][0]to see if at least one exists - Run
*[_type in ["testimonial"]]as an alternative syntax - Check
count(*[_type == 'testimonial'])to see if it returns a number - Try querying all types with
*[defined(_type)] | order(_type)and look for your testimonial documents
The fact that your array references work correctly suggests the documents definitely exist, so this is almost certainly a dataset selection issue in Vision's settings rather than a problem with your query syntax or schema. Double-check that dropdown!
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.