Inconsistent result when DELETE ... RETURNING as

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?

If the document is qualified for DELETE it will return true. Did you tried with Query workbench or cbq shell

DELETE FROM default WHERE ........... RETURNING META().id AS id;

In where clause provide the delete condition and returning META().id returns all the document id’s qualified for delete.

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

{
    "status": "success",
    "metrics": {
        "elapsedTime": "2.140203ms",
        "executionTime": "2.113572ms",
        "resultCount": 0,
        "resultSize": 0,
        "mutationCount": 1
    }
}