-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathdocs_sdk_put-transaction.html
More file actions
83 lines (73 loc) · 2.78 KB
/
docs_sdk_put-transaction.html
File metadata and controls
83 lines (73 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!-- Docs - SDK - putTransaction -->
<div class="section">
<h2><a href="/docs/">Docs</a> : <a href="/docs/sdk/">SDK</a> : putTransaction</h2>
<p><span class="font-semibold">putTransaction</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 to the database.</p>
<pre>
<code class="language-javascript">
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))
</code>
</pre>
<h3 id="params">Parameters</h3>
<ul>
<li>
<span class="field">databaseName</span> [string | Len: 1-100] - The database name to use.
</li>
<li>
<span class="field">operations</span> [Array | Len: 1-10] - The <a href="/docs/sdk/insert-item/">insert</a>, <a href="/docs/sdk/update-item/">update</a>, or <a href="/docs/sdk/delete-item/">delete</a> operations to execute as an atomic transaction. There is a limit of 10 operations per transaction.
</li>
</ul>
<h3 id="advanced-params">Advanced Parameters</h3>
<ul>
<li>
<span class="field">shareToken</span> [string | optional] - The token used to access a shared database.
</li>
<li>
<span class="field">databaseId</span> [string | optional] - The database's unique identifier.
</li>
</ul>
<h3 id="errors">Errors</h3>
<ul>
<li>ParamsMustBeObject</li>
<li>DatabaseNotOpen</li>
<li>DatabaseNameMissing</li>
<li>DatabaseNameMustBeString</li>
<li>DatabaseNameCannotBeBlank</li>
<li>DatabaseNameTooLong</li>
<li>DatabaseNameRestricted</li>
<li>DatabaseIdMustBeString</li>
<li>DatabaseIdCannotBeBlank</li>
<li>DatabaseIdInvalidLength</li>
<li>DatabaseIdNotAllowed</li>
<li>DatabaseIsReadOnly</li>
<li>OperationsMissing</li>
<li>OperationsMustBeArray</li>
<li>OperationsConflict</li>
<li>OperationsExceedLimit</li>
<li>CommandNotRecognized</li>
<li>ItemIdMissing</li>
<li>ItemIdMustBeString</li>
<li>ItemIdCannotBeBlank</li>
<li>ItemIdTooLong</li>
<li>ItemMissing</li>
<li>ItemInvalid</li>
<li>ItemTooLarge</li>
<li>ItemAlreadyExists</li>
<li>ItemDoesNotExist</li>
<li>ItemUpdateConflict</li>
<li>TransactionUnauthorized</li>
<li>UserNotSignedIn</li>
<li>UserNotFound</li>
<li>TooManyRequests</li>
<li>ServiceUnavailable</li>
</ul>
</div>
<hr>