The sequelize docs for create, findByPk and findAll state that a transaction should be passed as part of the options argument, here, but I've previously been using it as a separate arg with no issues (afaik):
await Example.create({
// options
}, { transaction: t });
I'd naturally believe the docs, but while looking for examples I've come across a lot of this latter usage, with some even suggesting the docs might be wrong here for example. Was hoping someone could clarify which is correct, or if it even matters?
I would advise looking at the individual methods that you are using within Sequelize to determine the proper place for a transaction property.
Your .create() example above is correct. The first argument to .create() is the CreationAttributes, and the second argument is the options object where the transaction would go. https://sequelize.org/api/v7/classes/model#create
The answer in the link you provided is incorrect. When using findAll(), the transaction property is supposed to go in the FindOptions object, which is the first and only argument to be passed in. The comments to the answer you linked correctly point out that the original poster's issues are related to something else. https://sequelize.org/api/v7/classes/model#findAll