Sanity Library Reference Docs
    Preparing search index...

    Interface SortOrderingItemBeta

    interface SortOrderingItem {
        direction: "desc" | "asc";
        field: string;
        nulls?: "first" | "last";
    }
    Index

    Properties

    direction: "desc" | "asc"
    field: string
    nulls?: "first" | "last"

    Controls whether null/undefined values appear first or last in the sort order.

    Defaults match PostgreSQL behavior:

    • 'desc' direction → nulls first
    • 'asc' direction → nulls last

    Only specify this to override the default (e.g. nulls: 'last' with direction: 'desc').

    Overriding the default may have performance implications for document types with hundreds of documents.