startKey/endKey in PHP SDK 2.x

The documentation does not show how to query a view with startKey and endKey. When trying to use the “keys” method in a query, it says to pass an array. When you pass an array, it says invalid json UTF-8. There’s no example on what the array should be, no documentation.

What we’re trying to do is iterate through documents in a bucket whose id starts with a specific string (example, list all documents that start with “apple_”)

Any help would be greatly appreciated!

Thanks!

Solved.

Works
$query->custom(array(‘startkey’ => ‘%22apple_%22’));

Doesn’t work
$query->custom(array(‘startkey’ => ‘apple_’));