SDK 3.1.0: viewQuery ViewOrdering not working

Hi,

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.

Cheers,
Giles

@ericb / @brett19 can one of you please help !

@giles thanks for your patience, looks like a legitimate defect, have filed a ticket

Fixes should be available in 3.1.1, thanks @brett19

@giles: You can find the fix attached to the issue which @AV25242 linked.


http://review.couchbase.org/c/couchnode/+/141508

Thanks for fixing this so quickly @brett19. I’ll try it out when 3.1.1 is released.