Transactional updates
Set options.transactional to true to treat all updates (primary and nested operations) as a single transaction. If any part of the operation fails (e.g., a validation error or a database constraint violation), the SDK rolls back all changes to ensure your data remains in its original state.
- Manta data table
- PostgreSQL
TypeScript
await manta.updateRecords({
table: "users",
data: { status: "archived" },
where: {
or: [
{ role: "inactive" },
{ lastLogin: { lessThan: "2024-01-01" } }
],
},
options: {
transactional: true,
},
});
TypeScript
await manta.updateRecords({
db: "auth_db",
table: "users",
data: { status: "archived" },
where: {
or: [
{ role: "inactive" },
{ lastLogin: { lessThan: "2024-01-01" } }
],
},
options: {
transactional: true,
},
});