Update transaction docs
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
<div class="section">
|
||||
<h2><a href="/docs/#sdk">SDK</a> : Transaction</h2>
|
||||
|
||||
<pre>
|
||||
<code class="language-javascript">userbase.transaction(databaseName, operations)
|
||||
.then(() => {
|
||||
<p><span class="font-semibold">Transaction</span> 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 in the database.</p>
|
||||
|
||||
})
|
||||
.catch((e) => console.error(e))</code>
|
||||
<pre>
|
||||
<code class="language-javascript">
|
||||
const operations = [
|
||||
{ command: 'Update', item: { todo: 'Item A' }, id: '0001' },
|
||||
{ command: 'Insert', item: { todo: 'Item B' }, id: '0002' },
|
||||
{ command: 'Delete', item: { todo: 'Item C' }, id: '0003' }
|
||||
]
|
||||
|
||||
userbase.transaction(databaseName, operations)
|
||||
.then(() => {
|
||||
// transaction applied
|
||||
})
|
||||
.catch((e) => console.error(e))
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<h3 id="params">Parameters</h3>
|
||||
@@ -16,7 +26,7 @@
|
||||
<span class="field">databaseName</span> [string | Len: 1-50] - The database name to use.
|
||||
</li>
|
||||
<li>
|
||||
<span class="field">operations</span> [Array] - The Insert, Update, or Delete operations to execute in an atomic transaction.
|
||||
<span class="field">operations</span> [Array] - The Insert, Update, or Delete operations to execute as an atomic transaction.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user