diff --git a/packages/plugins/workflow/src/triggers/collection.ts b/packages/plugins/workflow/src/triggers/collection.ts index b9b17dac75..1b5a4cd1d6 100644 --- a/packages/plugins/workflow/src/triggers/collection.ts +++ b/packages/plugins/workflow/src/triggers/collection.ts @@ -39,13 +39,15 @@ async function handler(this: WorkflowModel, data: Model, options) { // TODO: change to map filter format to calculation format // const calculation = toCalculation(condition); const { repository, model } = (this.constructor).database.getCollection(collection); + const { transaction } = options; const count = await repository.count({ filter: { $and: [ condition, { [model.primaryKeyAttribute]: data[model.primaryKeyAttribute] } ] - } + }, + transaction }); if (!count) {