interface updateOptions {
    benchmark?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
    byField?: string;
    fields?: sequelizeFunc<undefined> | never[] | sequelizeFunc<never[]>;
    hooks?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
    individualHooks?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
    limit?: number | sequelizeFunc<undefined> | sequelizeFunc<number>;
    logging?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true> | ((sql, timing?) => void) | sequelizeFunc<((sql, timing?) => void)>;
    middleware?: expressFunc;
    paranoid?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
    returning?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true> | never[] | sequelizeFunc<never[]>;
    sideEffects?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
    silent?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
    updatableFields?: customFields;
    validate?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>;
}

Hierarchy (view full)

  • operationFieldCore
  • expressCrudProps<Omit<UpdateOptions<unknown>, "where" | "transaction">>
    • updateOptions

Properties

benchmark?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

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

byField?: string
fields?: sequelizeFunc<undefined> | never[] | sequelizeFunc<never[]>

Fields to update (defaults to all fields)

hooks?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

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

individualHooks?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

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

Default

false
limit?: number | sequelizeFunc<undefined> | sequelizeFunc<number>

How many rows to update (only for mysql and mariadb)

logging?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true> | ((sql, timing?) => void) | sequelizeFunc<((sql, timing?) => void)>

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

Type declaration

    • (sql, timing?): void
    • Parameters

      • sql: string
      • Optional timing: number

      Returns void

middleware?: expressFunc
paranoid?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned. Only applies if options.paranoid is true for the model.

returning?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true> | never[] | sequelizeFunc<never[]>

Return the affected rows (only for postgres)

sideEffects?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

Whether or not to update the side effects of any virtual setters.

Default

true
silent?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

If true, the updatedAt timestamp will not be updated.

updatableFields?: customFields
validate?: boolean | sequelizeFunc<undefined> | sequelizeFunc<false> | sequelizeFunc<true>

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

Default

true