Reputation: 115
Hi I am having issues trying to delete entries in couchbase. My entry looks like this,
[ "default": {"status": "SUCCESS", "traceback": null, "result": 13, "task_id": "003bba0e-a9ff-44a5-8c79-7829878eb1bb", "children": []}]
where the entry is a celery task add entry.
I have tried the following queries but I keep getting no result or the entry not being deleted,
DELETE FROM default s WHERE s.task_id = "003bba0e-a9ff-44a5-8c79-7829878eb1bb" RETURNING s
DELETE FROM default WHERE "task_id" = "003bba0e-a9ff-44a5-8c79-7829878eb1bb"
but to no avail.
Upvotes: 0
Views: 121
Reputation: 661
Your first DELETE
statement is correct if the document is a JSON object with a top-level field of task_id
, so perhaps your document is not well-formed JSON.
### Add the document to the default bucket
INSERT INTO default (key, value) VALUES ("task1", {"status": "SUCCESS", "traceback": null, "result": 13, "task_id": "003bba0e-a9ff-44a5-8c79-7829878eb1bb", "children": []});
### Delete the document from the default bucket
DELETE FROM `default` s WHERE s.task_id = "003bba0e-a9ff-44a5-8c79-7829878eb1bb" RETURNING s;
Upvotes: 1