Have a function issue

Hi guys,

I am using ViewQuery.from(‘workbooks’,‘by_id’).range(wbKey,’/’,false);
it works fine if wbKey does not start with a number.
so I got the result for ‘-7wQNby8bsx_MrX3T-uBn26X’
but not for ‘1F48NXhh2IfjNmm-fCtpjgNN’…

Just wondering if this is a known issue and you may have a work around.

I am using node sdk.

Thank you!

Jasper

Hi @nateriverkira6,

In the future, you may want to ask Node related questions in the Node forum: https://www.couchbase.com/forums/c/node-js-sdk

I’m going to tag @brett19 to see if he can help.

Hey @nateriverkira6,
The views API performs range matching based on the passed strings as strings as opposed to numbers. Looking at the example strings you provided above, in the first (working) case, you are asking for strings from -… to / (which is 3 ASCII characters apart). In the second (non-working) case, you are asking for strings from 0… to / which is actually an inverted range (/ comes before 0, by 1 ASCII character). I imagine this is what is causing your issues and confusion.
Cheers, Brett

1 Like