Retrieving Long values throws TranscodingException

In the DAO layer I am trying to increment a Long value as following.

private final String MERCHANT_ITEM_COUNT_SUFFIX = "_item_count";

public Observable<Long> incrMerchantItemCount(String merchantId) {
        return _bucket.async().counter(merchantId + MERCHANT_ITEM_COUNT_SUFFIX, 1,1).map((jsoncLongDoc)->{
            return jsoncLongDoc.content();

DAO method to retrieve the Long value is as follows :

public Observable<Long> getMerchantItemCount(String merchantId) {
        return _bucket
                .get(merchantId + MERCHANT_ITEM_COUNT_SUFFIX, JsonLongDocument.class)
                    throw new DaoException(throwable);
                    return jsonLongDoc.content();
                    }).defaultIfEmpty(new Long(0));

But everytime this getMerchantItemCount() method throws following TranscodingException exception.

What am I doing wrong ?

Caused by: Flags
(0x0) indicate non JsonLongDocument id
9959dac0-c98d-11e1-8f0e-005056bd6853_itemcount, could not decode. at
~[java-client-2.0.2.jar:2.0.2] at
~[java-client-2.0.2.jar:2.0.2] at
~[java-client-2.0.2.jar:2.0.2] at$
~[java-client-2.0.2.jar:2.0.2] at$
~[java-client-2.0.2.jar:2.0.2] at
[rxjava-1.0.4.jar:1.0.4] … 13 common frames omitted

I ask the same question on SO and was asked to report a bug.But eventhough I could not login to “couch base forums” I could not loging to “JIRA”.

There was a minor problem with your user profile which I’ve fixed. After that, you should be able to file an issue without a problem. It may take a few minutes for the profile change to sync.

Thanks for reporting it, that definitely looks like a bug. I see that you’ve created and we are going to address it as soon as possible.


we’ve published a developer preview of 2.1.2 to get quicker feedback if the bug is properly fixed and your issues are addressed. You can get it from our couchbase repository like all pre-releases, the 2.1.2 GA release will be published to maven central as usual.

You can get it like this:


        <name>couchbase repo</name>

Keep in mind that this is not an officially tested release since it has not gone trough extensive QE testing yet. Please let us know if it works and upgrade to 2.1.2 as soon as it is released.