Help querying a CBL view sorted by date using REST API



I have an application written using the the Phonegap plugin (1.3) and Cordova. I am trying to improve the performance of a filtering and sorting a large data set (3K rows).

I created an index the emits a 3 value array of [account ID, Inspector ID, Date Time integer as YYYYMMDDHHMMSS] which works fine.

When I query the view using thew following (REST API).
startkey=[“113181201629554057946119539758595057121”,“189246924927434739593772751353671947738”,null]&endKey=[“113181201629554057946119539758595057121”,“189246924927434739593772751353671947738”, “99999999999999”]&limit=20&skip=0]

It returns rows even though the startkey does not exist in the view. It looks like it is doing a greater than or equal to instead of an equal to on the startkey. Is there any way to make this do an “equal to” on start key? I need the date as part of the key array to sort it properly so I can page the data to the screen in the correct order.

Sample row in result set:
“doc”: null,
“id”: “05d90fb1d9dd4803957e78dc2d6eb929_Inspection_be29a1cd292f47d7b961d0fd9a79b608”,
“value”: null,
“key”: [“113181201629554057946119539758595057121”, “202286596277076628159627591404617138106”, 20160722144600]


Use endkey, not endKey.


That was it! Thanks for your help - sometime you get so buried in the code you miss the obvious :slight_smile: