Fairly new to N1QL, so my expectations might be off, but I’m encountering inconsistent behavior when issuing DELETE commands through libcouchbase (built from git source 2.6.3)…
If the command (DELETE from foo returning true as c;) results in deleted doc(s) we receive the expected c == true result, however if the delete did not affect any docs, the result received is empty.
Should this be expected behavior? If so, is there a way to force the response honor the “returning true as c” clause?
Correct, we do receive TRUE if the doc is eligible for delete.
The problem is that we receive an empty response if the DELETE did not affect any docs even though the statement requests the “true” response.
It seems the “returning” clause only takes affect if the DELETE takes affect, which makes the response inconsistent… is this expected? Should it be? Is there a way to force an consistent response type?
BTW, this done programmatically using libcouchbase, no query shell involved.
RETURNING clause only takes affect when there is qualified items. If there is no items qualified, nothing to return. There is no inconsistency.
You can check the status completion of statement. metrics.mutationCount is present it will tell how many items it qualified for delete