Format for start and end keys when making REST calls

#1

Hi,

I’ve got my views setup. Now I want to filter the results based on startKey and endKey. I’ve constructed my query string as such:

?group=true&group_level=1&endKey=%5B%22test_7%22%2C%7B%7D%5D&startKey=%5B%22test_7%22%5D

which the startKey and and endKey is based on this object:

var queryParams = { startKey : JSON.stringify([‘test_7’]), endKey : JSON.stringify([‘test_7’, {}]) }

But when I invoke the API I still get back all the rows.

Looking for suggestions on resolving this.

Thanks,

Adrian

#2

The parameter names are startkey and endkey.

http://developer.couchbase.com/documentation/mobile/1.2/develop/references/couchbase-lite/rest-api/design-document/get---db--design--design-doc--view--view-name-/index.html

#3

Doh!!

Thanks. But now the “rows” array is empty.

#4

Figured it out. The second array element should not be used if I’m only defining a single element array key.

Thanks for your help @jens