noebs

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.

    
    const operations = [
      { command: 'Update', item: { todo: 'Item A' } },
      { command: 'Insert', item: { todo: 'Item B' }, itemId: '0002' },
      { command: 'Delete', itemId: '0003' }
    ]

    userbase.putTransaction({ databaseName, operations })
      .then(() => {
        // transaction applied
      })
      .catch((e) => console.error(e))
    
  

Parameters

Errors