Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change Site Theme

Changelog

Track new features, improvements, and fixes across all Sanity products.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Changelog

Track new features, improvements, and fixes across all Sanity products.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

On this page

Filter by product

Filter by product

Apps
  • 6
  • 1
  • 18
  • 1
  • 6
  • 7
  • 6
  • 14
  • 3
  • 310
  • 2
  • 1
Integrations & Libraries
  • 15
  • 6
  • 2
  • 4
  • 2
  • 2
  • 9
  • 1
  • 1
  • 1
  • 6
  • 9
  • 4
  • 1
  • 3
Subscribe to the changelog
  • RSS (Latest)
  • RSS (Full)
  • JSON Feed (Latest)
  • JSON Feed (Full)
  1. Changelog
  2. Integrations & Libraries
  3. GROQ

New GROQ functions to interact with Global Document References (GDR)

Published: October 30, 2025

v2021-03-25

This update adds improved ways of interacting with and detecting Global Document References (GDR). At this time, these are mostly limited to queries that interact with Media Library assets.

✨ Highlights

Get incoming GDR count

You can now use the documents::incomingGlobalDocumentReferenceCount() function in GROQ to check if a document has incoming GDRs. This only returns the number of GDRs referencing the current document scope.

// Find all documents being referenced by at least 1 GDR, and return the document's ID and reference count
*[documents::incomingGlobalDocumentReferenceCount() > 0] { 
  _id, 
  "incomingGDRCount": documents::incomingGlobalDocumentReferenceCount() 
}

Resolve GDR references

In case you missed it, you can also use documents::get(media), where media is the reference, to resolve GDRs similar to the -> syntax used with normal references.

*[_type == "post"][0]{
  _id,
  mainImage{
    "url": asset->url,
    "mlAsset": documents::get(media)
  }
}

Related documentation

  • GROQ Functions Reference

  • Global Document Reference

Loading...

On this page

  • ✨ Highlights
  • Get incoming GDR count
  • Resolve GDR references
Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Agent Actions
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates

Related documentation

  • GROQ Functions Reference

  • Global Document Reference

// Find all documents being referenced by at least 1 GDR, and return the document's ID and reference count
*[documents::incomingGlobalDocumentReferenceCount() > 0] { 
  _id, 
  "incomingGDRCount": documents::incomingGlobalDocumentReferenceCount() 
}
*[_type == "post"][0]{
  _id,
  mainImage{
    "url": asset->url,
    "mlAsset": documents::get(media)
  }
}

Previous Changelog

Fixes Studio authentication race condition

October 21, 2025

Sanity React App SDK

Next Changelog

Shopify shop domain added to sync

November 4, 2025

Sanity Connect for Shopify