Couchbase Server 7.2 Cannot Delete Documents or retrieve them by meta().id

Hi,

A grouping query gives me a document count and tells me, there are thousands of documents with a specific change date.

  • However, when I try to get any one of these documents by their meta().id either through query or via the Documents tab - no such document is found.
  • When I try to execute a delete statement - it tells me the delete statement has completed, and yet the initial groping query shows me all these documents exist.

Please help me get rid of these documents!

//1st Query - says many documents exist
SELECT Count(1), cccp.changedDate, MAX(meta(cccp).id)
FROM myBucket cccp
WHERE cccp._class = ‘MyClassName’
AND cccp.changedDate LIKE ‘2022-02%’
GROUP BY cccp.changedDate

[
{
“$1”: 2,
“$2”: “MyDoc#|2022-02-10|…”, //putting these dots so I don’t give the full doc names here
“changedDate”: “2022-02-10”
},
{
“$1”: 19197,
“$2”: “MyDoc#|2022-02-23|…”,
“changedDate”: “2022-02-23”
},
{
“$1”: 1,
“$2”: “MyDoc#|2022-02-24|…”,
“changedDate”: “2022-02-24”
}
]

//Now I run this delete
DELETE FROM myBucket cccp
WHERE cccp._class = ‘MyClassName’
AND cccp.changedDate LIKE ‘2022-02%’

and it completes successfully, but then if I run the 1st query above - it gives me the same results, i.e. nothing was deleted

In the “metrics” section for the DELETE, do you have a mutation count > 0 ?

Is the first Query covered by an index? (EXPLAIN would reveal.)

Updates to indexes are not synchronous - so when you delete documents, the index data is still present for a short time. If your query is “index covered” (i.e. the result can be returned by accessing only indexes), then the results can be returned even after the documents have been deleted. That’s one possibility. One way to avoid that is - after the delete, execute the query with the option QueryConsistency = REQUEST_PLUS

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.