dyna-record
    Preparing search index...

    Type Alias UpdateOptions<T>

    Attributes of an entity to update. Not all properties are required. Setting a nullable property to null will remove the attribute from the item.

    For @ObjectAttribute fields, all nested fields are Partial — you only need to provide the fields you want to change. Omitted fields are preserved in DynamoDB via document path expressions.

    A list is written whole, so each element of a list of objects keeps its required fields, while a nullable field inside an element takes null and the element is stored without it.

    Type Parameters

    • T extends default

      The entity being updated.

    await Customer.update("customer-1", {
    name: "Jane Smith", // Sets new value
    phone: null // Removes the value. A compile error if the attribute is not nullable
    });
    await Store.update("store-1", {
    address: { street: "456 Oak Ave" } // Only updates street, preserves other fields
    });
    // Replaces the contacts; Sam's is stored without a phone
    await Store.update("store-1", {
    address: { contacts: [{ name: "Sam", phone: null }] }
    });