Joint session with Vercel: How to build intelligent storefronts (May 15th)

Reference field not finding documents after converting object to document type

7 repliesLast updated: Nov 30, 2025

I am trying to get a document to refrence other documents of the same type. But I only get "No results" when trying to search for instances of that document type.
The document type was an object up until an hour ago ish, I changed it to a document type because it seems like refrences only works for documents, Then I crated some new instances of that document but cannot find them either.

https://pastebin.com/Fgx3YRP3
Any ideas?
🙂
AI Update

I can see the issue in your schema! Looking at the pastebin, on lines 11-22, you have a duplicate type definition that's causing the problem:

{
  type: "string",  // ← Line 12: This is wrong!
  title: "Related success criterion",
  name: "accessibilityRelatedSuccessCriterion",
  type: "array",   // ← Line 14: This gets overridden by line 12
  of: [
    {
      type: "reference",
      to: [{ type: "successCriterion" }],
    },
  ],
},

The fix: Remove the type: "string" on line 12. It should be:

{
  title: "Related success criterion",
  name: "accessibilityRelatedSuccessCriterion",
  type: "array",
  of: [
    {
      type: "reference",
      to: [{ type: "successCriterion" }],
    },
  ],
},

Why you're getting "No results":

Steps to fix:

You were absolutely right that references only work with document types (not objects), so that change was necessary. Once you fix the duplicate type and restart, everything should work as expected! 🙂

Show original thread
7 replies

Was this answer helpful?

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.

Related contributions