SDK 3.1.0 - using viewQuery to rebuild view is *much* slower than 2.6

After adding or removing a doc from a large bucket I am trying to ensure views are up-to-date. I have always been able to do this by running a query with limit=0 and stale set to before. My bucket has around 861,000 docs.

With Node 10.14 and CB 2.6.1, if I run a viewQuery with limit=0 and stale set to BEFORE, it takes between 70ms and 200ms.
With Node 14.4 and CB 3.1.0, I run a query with limit = 0 and viewScanConsistency set to RequestPlus, which I think is the equivalent of stale set to BEFORE. It takes between 22000 and 35000 ms!

Both of the above tests are using CB 6.6.0.

Maybe this isn’t the best method of ensuring a view is up-to-date. If not, do you have an alternative?

My reason for wanting to use SDK 3 is because I want to update to Node 14. Given that I’ve found numerous issues with SDK 3, it doesn’t seem to be production ready and I would prefer to go back to 2.6 at this point, to allow 3 to have a bit more development and testing time. However, binaries for Node 14 are not available for SDK 2.6 and there are errors when it tries to build them. Therefore I have to use 3 at the moment.


I have found the bug…

lib/viewexecutor.js has the following code:

    if (options.limit) {
      queryOpts.limit = options.limit;

I am passing limit=0. Therefore this if statement is false and limit=0 is not added to the query URL, so all 861,000 docs are returned.

If I change the above if statement to if (options.hasOwnProperty("limit")) the query works as expected and takes the same length of time as SDK 2.6.

please can this be fixed asap (and I would also suggest checking the other options to make sure that they handle 0 values if appropriate).


@giles an issue has been created to address this problem

Hi @AV25242,

Do you have an update on this? There are no comments on the Jira.


Should be there by tomorrow hopefully.

1 Like

Hi @giles , just following up. Node 3.1.1 was released hope you are able to move forward.

Thanks @AV25242, I had previously moved forward by making my request with limit=1. I will remove this fudge and try 3.1.1.


1 Like