idRange not working

Description

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.

Environment

None

Gerrit Reviews

None

Release Notes Description

None

Activity

Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created December 4, 2020 at 7:55 PM
Updated January 12, 2021 at 10:40 PM
Resolved January 12, 2021 at 10:40 PM
Instabug