Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

Is there a way to set the default state of a boolean to (false)?

3 replies
Last updated: Nov 12, 2020

Is there a way to set the default state of a boolean to (false)?

Nov 11, 2020, 5:56 PM

I'm wondering this too

Nov 11, 2020, 9:06 PM

For documents you can use initial value templates ( ). For objects you can't

Nov 12, 2020, 6:18 AM

Make sure your front-end code treats a missing boolean value as false.
In GROQ you can handle missing booleans and false values equally like this 
*[_type == 'story' && featured != true]
 which would match stories where featured is false or missing (or to be fair, any other value that is not

Nov 12, 2020, 6:19 AM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Free to get started, pay-as-you-go on all plans.