©2015 - 2022 Chad’s Technoworks. Disclaimer and Terms of Use

Chad’s TechnoWorks My Journal On Technology

Information Technology

COUCHBASE CRUD OPERATIONS USING CBC - page 3

 Prev< 1 2 3

D = DELETE A DOCUMENT


CBC Delete By Example


cbc rm -U http://lxnode5.vlabs.net/CRUD_Lab emp_1234


[couchbas@lxnode4 ~]$ cbc rm -U http://lxnode5.vlabs.net/CRUD_Lab emp_1234

emp_1234            Deleted. CAS=0x100361ff28d2b14

[couchbas@lxnode4 ~]$



N1QL Delete By Example



DELETE By Using A Key


cbc n1ql -U http://lxnode5.vlabs.net 'DELETE FROM CRUD_Lab USE KEYS "emp_1234"'


[couchbas@lxnode4 ~]$ cbc n1ql -U http://lxnode5.vlabs.net 'DELETE FROM CRUD_Lab USE KEYS "emp_1234"'

Encoded query: {"statement":"DELETE FROM CRUD_Lab USE KEYS \"emp_1234\""}


** N1QL Response finished

{

    "requestID": "9c40f2c8-a8af-4281-ac61-595be8c16267",

    "signature": null,

    "results": [

    ],

    "status": "success",

    "metrics": {

        "elapsedTime": "69.758563ms",

        "executionTime": "68.938422ms",

        "resultCount": 0,

        "resultSize": 0

    }

}


[couchbas@lxnode4 ~]$



DELETE By Using Conditions


cbc n1ql -U http://lxnode5.vlabs.net 'DELETE FROM CRUD_Lab c WHERE c.ename = "KYLE" RETURNING c.empno'


[couchbas@lxnode4 ~]$ cbc n1ql -U http://lxnode5.vlabs.net 'DELETE FROM CRUD_Lab c WHERE c.ename = "KYLE" RETURNING c.empno'

Encoded query: {"statement":"DELETE FROM CRUD_Lab c WHERE c.ename = \"KYLE\" RETURNING c.empno"}


{

            "empno": 1234

        },

** N1QL Response finished

{

    "requestID": "5567a5a3-a56f-4cba-a9fa-47facae8bf47",

    "signature": {

        "empno": "json"

    },

    "results": [

        ],

    "status": "success",

    "metrics": {

        "elapsedTime": "19.803503ms",

        "executionTime": "19.723635ms",

        "resultCount": 1,

        "resultSize": 37,

        "mutationCount": 1

    }

}


[couchbas@lxnode4 ~]$