Startkey and endkey feature in view for PREPARE/EXECUTE statement

This is not really a question of PREPARE. You can use BETWEEN, <, >, <=, <=, AND, OR, and other features of N1QL to specify the ranges of data you want.

You should also use EXPLAIN to understand how your query would be executed (make sure it is using an index).