Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Understanding the difference between `_id` and `id` in GraphQL

3 replies
Last updated: Apr 3, 2020
What's the difference between
_id
and
id
when using graphql?
Apr 3, 2020, 4:10 PM
I'm pretty sure the difference is, that "id" is automatically generated no matter what. With "_id" you can define it yourself - but if you do not do that, it will be auto generated as well.
Apr 3, 2020, 4:24 PM
Gotcha, OK thanks
Apr 3, 2020, 4:27 PM
_id
is the document field that comes from Sanity and
id
is the node id that Gatsby generates :)
Apr 3, 2020, 5:19 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?