SDK 3.1.0: viewQuery idRange not working

Hi,
I can’t get idRange to work in SDK 3.x (up to .3.1.0).
I am passing a valid range start and end, and without idRange set it returns all docs between start and end. However, if I then set idRange start/end it doesn’t return any results. I know that the IDs passed in idRange must match docs returned by the range keys.

If I try the same query in the CB GUI I can get it to work. However, I need to make sure that the IDs passed for startkey_docid and endkey_docid are not quoted. i.e. 123456 works but "123456" doesn’t. Looking in the SDK source I think this points me to the problem. In viewexecutor.js it says:

    if (options.idRange) {
      queryOpts.startkey_docid = JSON.stringify(options.idRange.start);
      queryOpts.endkey_docid = JSON.stringify(options.idRange.end);
    }

I think the start and end values should not be stringified as I think that will send the values to CB with the quotes. I haven’t rebuilt the SDK source to test this possible fix though so I’m not certain it’s the issue.

Hope this helps and you can provide a fix quickly.

Thanks,
Giles

Thanks @brett19 for jumping and taking a look at it.

@giles this seems to be a defect and will be resolved with this ticket

Fixes should be available in 3.1.1, thanks @brett19 for the quick turnaround

@giles: You can find the fix attached to the issue which @AV25242 linked.
https://issues.couchbase.com/browse/JSCBC-823
http://review.couchbase.org/c/couchnode/+/141509

1 Like