Unable to query a view by key on 3.0.0 on MacOS

Hi,

I wanted to check here in the forum before filing a bug as this is such a fundamental operation I’m sure the problem is mine.

I upgraded from 2.2 to 3.0 on my Mac (running 10.10). Everything works except I can’t query a view by key. I can replicate this by:

  1. Creating a new bucket
  2. Creating a new design document with this map and no reduce

function (doc, meta) {
if (doc.type) {
emit(doc.type, null);
}
}

  1. With just one document in the bucket, if I run the query I get:

{“total_rows”:1,“rows”:[
{“id”:“1-test-1”,“key”:“customer”,“value”:null}
]
}

Using the web interface to add “customer” as the key I get the following query and no result

http://127.0.0.1:8092/MyBucket/_design/dev_test/_view/finder?stale=false&inclusive_end=false&key="customer"&connection_timeout=60000&limit=10&skip=0

{“total_rows”:1,“rows”:[
]
}

I get the same when querying directly via the REST api.

The same setup returns a row in 2.2 (running on a Linux server). Have I missed anything obvious?

Thanks

Marcus

Ok, I found the answer. I needed to set inclusive_end to true. Then it all works as normal.

True is the default for inclusive_end, so you could also just remove that query param.

(This shouldn’t be a change in behavior from 2.x, though.)

—Jens

That’s weird then, as I had the same behaviour with a new install of 3.0.0 on Ubuntu as on Mac OS X- I had to go in and tick the inclusive_end box to get the single result.

If you think we can reproduce this, it’d be great if you could file an issue on Couchbase Server.

Issue filed. The difference is in the GUI default filter

On version 2

?stale=false&connection_timeout=60000&limit=10&skip=0

but inclusive_end is treated as true even when not set to true in the filter results dialog.

On version 3.0 inclusive_end is set to false

?stale=false&inclusive_end=false&connection_timeout=60000&limit=10&skip=0

I have also run into this issue with Couchbase 3.0, and the inclusive_end change worked for me as well.

However, trying to run the same query using a key via the Nodejs SDK returns no results.
e.x.: var query = ViewQuery.from(‘bucket’, ‘returnId’).key(“123”);

When I run the same thing against a box with Couchbase 2.2 installed, I do get a result (everything is the same in both databases).

Also experiencing the same issue with 3.0 on Windows. inclusive_end allows it to work.