I’m using v3.0.4 of Couchbase SDK.
According to Data Operations | Couchbase Docs, to delete a document I can run:
var result = await collection.RemoveAsync(“document-key”,
options =>
{
options.WithCas(12345);
options.WithTimeout(TimeSpan.FromSeconds(5));
}
);
Code above has an issue. The signature of RemoveAsync
is
Task RemoveAsync(string id, [NullableAttribute(2)] RemoveOptions options = null);
It returns Task
, which await
convert to void and you can’t assign void
to a value, hence compiler generates the CS0815 C# Cannot assign void to an implicitly-typed variable
If I run the code as await collection.RemoveAsync("document-key");
without assignment, error is gone.
With all this said, there is no usable return that I can check against, to find out if the document removal operation was success or not ? How do I check if it was success of failure ?