Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-9327

Add an example of statement level atomicity for transactions to the documentation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • 7.0.2
    • 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"     }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            simon.dew Simon Dew
            kamini.jagtiani Kamini Jagtiani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty