Documentation
    Preparing search index...

    Interface BulkCreateOptions<TAttributes>

    Options for Model.bulkCreate method

    interface BulkCreateOptions<TAttributes = any> {
        benchmark?: boolean;
        conflictAttributes?: (keyof TAttributes)[];
        conflictWhere?: WhereOptions<TAttributes>;
        connection?: AbstractConnection | null;
        fields?: (keyof TAttributes)[];
        hooks?: boolean;
        ignoreDuplicates?: boolean;
        include?: AllowArray<Includeable>;
        individualHooks?: boolean;
        logging?: false | ((sql: string, timing?: number) => void);
        returning?: boolean | (Col | Literal | keyof TAttributes)[];
        searchPath?: string;
        transaction?: Transaction | null;
        updateOnDuplicate?: (keyof TAttributes)[];
        validate?: boolean;
    }

    Type Parameters

    • TAttributes = any

    Hierarchy (View Summary)

    Index
    benchmark?: boolean

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

    conflictAttributes?: (keyof TAttributes)[]

    Optional override for the conflict fields in the ON CONFLICT part of the query. Only supported in Postgres >= 9.5 and SQLite >= 3.24.0

    conflictWhere?: WhereOptions<TAttributes>

    An optional parameter to specify a where clause for partial unique indexes (note: ON CONFLICT WHERE not ON CONFLICT DO UPDATE WHERE). Only supported in Postgres >= 9.5 and sqlite >= 9.5

    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 insert (defaults to all fields)

    hooks?: boolean

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

    true
    
    ignoreDuplicates?: boolean

    Ignore duplicate values for primary keys?

    false
    

    Include options. See find for details

    individualHooks?: boolean

    Run before / after create hooks for each individual Instance? BulkCreate hooks will still be run if BulkCreateOptions.hooks is true.

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

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

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

    Return all columns or only the specified columns for the affected rows (only for postgres)

    searchPath?: string

    An optional parameter to specify the schema search_path (Postgres only)

    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.

    updateOnDuplicate?: (keyof TAttributes)[]

    Fields to update if row key already exists (on duplicate key update)? (only supported by MySQL, MariaDB, SQLite >= 3.24.0 & Postgres >= 9.5).

    validate?: boolean

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

    false