Details
-
Bug
-
Resolution: Won't Fix
-
Major
-
Cheshire-Cat
-
None
-
1
Description
Can you please add an example of Statement level atomicity to
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/transactions.html
Example 1:
START TRANSACTION;
INSERT INTO employee VALUES("key10", {"age":50});
INSERT INTO employee VALUES("key10", {"age":55});-->error.Tx continues and user is given an option to correct his stmt/commit/rollback.
INSERT INTO employee VALUES("key11", {"age":55});
COMMIT ;
Example 2:
cbq> begin work;
{ "txid": "d0929f1a-2726-47c2-9839-73c9cabf5aff" } { "resultCount": 1, "status": "success" }cbq> insert into c1 values("k2", {"b":2});
{ "mutationCount": 1, "status": "success" }cbq> insert into c1 values("k3", {"b":2}), ("k2", {"b":2});
{ "errors": [ \{ "code": 17012, "msg": "Duplicate Key: k2" }
],
}
cbq> commit;
{ "resultCount": 0, "status": "success" }
cbq> select meta().id, * from c1;------notice there is no k3
{
"c1":
{ "a": 1 },
"id": "k1"
},
{
"c1":
{ "b": 2 },
"id": "k2"
}
,
{ "resultCount": 2, "status": "success" }