如何在couchbase中删除?

How to delete in couchbase?

您好,我在尝试删除 couchbase 中的条目时遇到问题。我的条目看起来像这样,

[ "default": {"status": "SUCCESS", "traceback": null, "result": 13, "task_id": "003bba0e-a9ff-44a5-8c79-7829878eb1bb", "children": []}]

其中条目是芹菜任务添加条目。

我尝试了以下查询,但一直没有结果或条目未被删除,

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"

但无济于事。

如果文档是具有顶级字段 task_id 的 JSON 对象,那么您的第一个 DELETE 语句是正确的,所以您的文档可能格式不正确 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;