
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeIf you want to limit a reference field to just one entry instead of an array, simply use the reference type directly without wrapping it in an array. Here's the difference:
Single reference (what you want):
{
name: 'director',
title: 'Director',
type: 'reference',
to: [{type: 'person'}]
}This gives you a single reference field where you can select one document.
Multiple references (array):
{
name: 'directors',
title: 'Directors',
type: 'array',
of: [
{
type: 'reference',
to: [{type: 'person'}]
}
]
}This gives you an array where you can add as many references as you want.
So the key is: use type: 'reference' directly for a single entry, or wrap it in an array for multiple entries. The reference type itself is always for a single document - it's the array wrapper that allows multiple selections.
You can read more about reference fields in the Sanity reference type documentation.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store