In SDK 3 up to and including 3.1.0, the ViewOrdering parameter is not working. An order value of ViewOrdering.Descending is ignored and the results are returned in ascending order.
Also, if you set order to Descending, and a range with start set to the high key and end set to the low key, you get an error:
‘No rows can match your key range, reverse your start_key and end_key or set descending=true’
I’ve just looked at the SDK source and can see the reason for this. In viewexecutor.js it says:
if (options.order > 0) {
queryOpts.descending = false;
} else if (options.order < 0) {
queryOpts.descending = true;
}
This should be “if (options.order === ViewOrdering.Ascending)…”. If I pass a value of -1 to order it works.