C SDK exists() API


#1

Hi,

Is there an api in C SDK similar to JAVA SDKs ‘boolean exists()’ API. The purpose is to only check if the document ID exist and not to retrieve the entire document as the size could be very large.

I did not find any relevant API in 2.9 documentation.
As a workaround, i am thinking of a sub-document lookup, but in some cases I may not no the subdocument attribute.

Thanks,
Jatin


#2

You can find exist implementation of Java SDK here

https://github.com/couchbase/couchbase-java-client/blob/master/src/main/java/com/couchbase/client/java/bucket/api/Exists.java#L52-L78

As you can see all it does is sending OBSERVE command. Libcouchbase has example of using OBSERVE here:

https://github.com/couchbase/libcouchbase/blob/2.9.3/example/observe/observe.c#L112-L136

API documentation is here:

http://docs.couchbase.com/sdk-api/couchbase-c-client-2.9.3/group__lcb-durability.html#gaaf9714d176e105b8ed03f6c12c7e9e3b