Documentation
    Preparing search index...

    Interface UpdateOptions<TAttributes>

    Options used for Model.update

    interface UpdateOptions<TAttributes = any> {
        benchmark?: boolean;
        connection?: AbstractConnection | null;
        fields?: (keyof TAttributes)[];
        hooks?: boolean;
        individualHooks?: boolean;
        limit?: number | Nullish | Literal;
        logging?: false | ((sql: string, timing?: number) => void);
        paranoid?: boolean;
        returning?: boolean | (Col | Literal | keyof TAttributes)[];
        sideEffects?: boolean;
        silent?: boolean;
        transaction?: Transaction | null;
        validate?: boolean;
        where: WhereOptions<TAttributes>;
    }

    Type Parameters

    • TAttributes = any

    Hierarchy (View Summary)

    Index
    benchmark?: boolean

    Pass query execution time in milliseconds as second argument to logging function (options.logging).

    connection?: AbstractConnection | null

    The connection on which this query must be run. Mutually exclusive with Transactionable.transaction.

    Can be used to ensure that a query is run on the same connection as a previous query, which is useful when configuring session options.

    Specifying this option takes precedence over CLS Transactions. If a transaction is running in the current AsyncLocalStorage context, it will be ignored in favor of the specified connection.

    fields?: (keyof TAttributes)[]

    Fields to update (defaults to all fields)

    hooks?: boolean

    If false the applicable hooks will not be called. The default value depends on the context.

    true
    
    individualHooks?: boolean

    Run before / after update hooks?. If true, this will execute a SELECT followed by individual UPDATEs. A select is needed, because the row data needs to be passed to the hooks

    false
    
    limit?: number | Nullish | Literal

    How many rows to update

    Only for mysql and mariadb, Implemented as TOP(n) for MSSQL; for sqlite it is supported only when rowid is present

    logging?: false | ((sql: string, timing?: number) => void)

    A function that gets executed while running the query to log the sql.

    paranoid?: boolean

    If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned.

    Only applies if InitOptions.paranoid is true for the model.

    true
    
    returning?: boolean | (Col | Literal | keyof TAttributes)[]

    Return the affected rows (only for postgres)

    false
    
    sideEffects?: boolean

    Whether to update the side effects of any virtual setters.

    true
    
    silent?: boolean

    If true, the updatedAt timestamp will not be updated.

    transaction?: Transaction | null

    The transaction in which this query must be run. Mutually exclusive with Transactionable.connection.

    If the Sequelize disableClsTransactions option has not been set to true, and a transaction is running in the current AsyncLocalStorage context, that transaction will be used, unless null or another Transaction is manually specified here.

    validate?: boolean

    Should each row be subject to validation before it is inserted. The whole insert will fail if one row fails validation.

    true
    

    Options to describe the scope of the search.