OptionalassociationOptionalattributesIf an array: a list of the attributes that you want to select.
Attributes can also be raw SQL (literal), fn, col, and cast
To rename an attribute, you can pass an array, with two elements:
literal, fn, col, cast),If include is used: selects all the attributes of the model,
plus some additional ones. Useful for aggregations.
OptionalbenchmarkPass query execution time in milliseconds as second argument to logging function (options.logging).
OptionalbindEither an object of named parameter bindings in the format $param or an array of unnamed
values to bind to $1, $2, etc in your SQL.
OptionalconflictOptional override for the conflict fields in the ON CONFLICT part of the query. Only supported in Postgres >= 9.5 and SQLite >= 3.24.0
OptionalconflictAn 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
OptionalconnectionThe 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.
OptionalfieldMap returned fields to arbitrary names for SELECT query type if options.fieldMaps is present.
OptionalfieldsFields to insert (defaults to all fields)
OptionalforceIf set to true, paranoid models will actually be deleted
OptionalgroupGROUP BY in sql
OptionalgroupedOptionalhavingSelect group rows after groups and aggregates are computed.
OptionalhooksIf false the applicable hooks will not be called.
The default value depends on the context.
OptionalignoreIgnore duplicate values for primary keys?
OptionalincludeA list of associations to eagerly load using a left join (a single association is also supported).
See Includeable to see how to specify the association, and its eager-loading options.
OptionalindexMySQL only.
OptionalindividualRun before / after create hooks for each individual Instance? BulkCreate hooks will still be run if BulkCreateOptions.hooks is true.
OptionalinstanceA sequelize instance used to build the return instance
OptionallimitLimits how many items will be retrieved by the operation.
If limit and include are used together, Sequelize will turn the subQuery option on by default.
This is done to ensure that limit only impacts the Model on the same level as the limit option.
You can disable this behavior by explicitly setting subQuery: false, however limit will then
affect the total count of returned values, including eager-loaded associations, instead of just one table.
OptionallockLock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model locks with joins. See Lock.
OptionalloggingA function that gets executed while running the query to log the sql.
OptionalmapMap returned fields to model's fields if options.model or options.instance is present.
Mapping will occur before building the model instance.
OptionalmaxThis sets the max execution time for MySQL.
OptionalminifyControls whether aliases are minified in this query. This overrides the global option
OptionalnestIf true, transforms objects with . separated property names into nested objects using
dottie.js. For example { 'user.username': 'john' } becomes
{ user: { username: 'john' }}. When nest is true, the query type is assumed to be 'SELECT',
unless otherwise specified
OptionaloffsetSkip the first n items of the results.
OptionalomitA flag that defines if null values should be passed as values or not.
OptionalorderSpecifies an ordering. If a string is provided, it will be escaped.
Using an array, you can provide several attributes / functions to order by. Each element can be further wrapped in a two-element array:
OptionalparanoidIf 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.
OptionalplainSets the query type to SELECT and return a single row
OptionalrawReturn raw result. See Sequelize#query for more information.
OptionalrejectThrows an error if the query would return 0 results.
OptionalreplacementsEither an object of named parameter replacements in the format :param or an array of unnamed
replacements to replace ? in your SQL.
OptionalresetClear all previously set data values
OptionalretryOptionalreturningReturn all columns or only the specified columns for the affected rows (only for postgres)
OptionalsearchAn optional parameter to specify the schema search_path (Postgres only)
OptionalsilentIf true, the updatedAt timestamp will not be updated.
OptionalskipSkip locked rows. Only supported in Postgres.
OptionalsubUse sub queries (internal).
If unspecified, this will true by default if limit is specified, and false otherwise.
See FindOptions#limit for more information.
OptionalsupportsIf false do not prepend the query with the search_path (Postgres only)
OptionaltableUse a table hint for the query, only supported in MSSQL.
OptionalthroughOptionaltransactionThe 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.
OptionaltypeThe type of query you are executing. The query type affects how results are formatted before they are
passed back. The type is a string, but Sequelize.QueryTypes is provided as convenience shortcuts.
OptionalupdateFields to update if row key already exists (on duplicate key update)? (only supported by MySQL, MariaDB, SQLite >= 3.24.0 & Postgres >= 9.5).
OptionaluseForce the query to use the write pool, regardless of the query type.
OptionalvalidateShould each row be subject to validation before it is inserted. The whole insert will fail if one row fails validation
OptionalwhereThe WHERE clause. Can be many things from a hash of attributes to raw SQL.
Visit https://sequelize.org/docs/v7/core-concepts/model-querying-basics/ for more information.
The options for the addAssociation mixin of the belongsToMany association.
See
BelongsToManyAddAssociationMixin