Userbase

Docs : SDK : putTransaction

putTransaction lets you submit multiple database operations as a single atomic batch. Either all operations succeed, or the entire batch fails. You will never see partial updates. This API will return a promise that gets resolved once the transaction has been fully applied and durably persisted to the database.

userbase.putTransaction({
  databaseName: 'example-database-name',
  operations: [
    { command: 'Insert', item: { example: 'Sample Item A' } },
    { command: 'Update', item: { example: 'Sample Item B' }, itemId: '0002' },
    { command: 'Delete', itemId: '0003' }
  ]
}).then(() => {
  // transaction applied
}).catch((e) => console.error(e))

Parameters

Advanced Parameters

Errors