I have a problem about ViewQuery api issue.
below uri is Filter Results of couchbase console.
?startkey=%5B%2221st_amendment_brewery%22%5D&endkey=%5B%2221st_amendment_brewery.%22%5D&inclusive_end=false&stale=update_after&connection_timeout=60000&limit=10&skip=0
It’s working fine.
but, ViewQuery reslut of java sdk 2.0.1 is nothing
Here is code
Actually, it’s not a bug - it’s a feature - you were just using the wrong method. If you pass in a string into startKey it will surround it with “”. Since you want to pass in a Json array, use the overload for the array!
.startKey(JsonArray.from(“21st_amendment_brewery”)) and the same for endKey.
The reason of why is below.
As i mentioned before, The result of uri(viewquery.toString()) is different compared couchbase console.
below link is made by couchbase console.
Can you please post the full code you’re using? I’m pretty sure you’re using the wrong method calls.
Every method where JSON is supported on the view query the code provides overloads for all possible json values. If you pass in a string it will be quoted. In your case you need an array of strings, so you need to pass in a JsonArray so it can properly be converted.
Hi Daschl,
I use startKey and endKey in Couchbase web console view works, but when I use the java api like this:
query.startKey(JsonArray.from(“football.na.usa:team=cle”))
.endKey(JsonArray.from(“football.na.usa:team=cle\u0FFF”))
.descending(true).limit(10))
I got empty result, should I endcode “\u0FFF”? Please help.