ravendb/ravendb-nodejs-client

Streaming not Working

Closed this issue · 5 comments

Hello, with v5.2.7 streaming works, with v5.4.2 streaming immediately responds as done with 0 results.

This is the code:

    const entities: Draw[] = [];
    const reader = await session.advanced.stream<Draw>(session.query<Draw>({ collection: 'Draws' }));

    reader.on('data', (data) => {
      entities.push(data.document);
    });

    await StreamUtil.finishedAsync(reader);

Also, I had to import StreamUtil like, because Typescript cannot seem to find it and don't believe it is exported as StreamUtil:
import * as StreamUtil from 'ravendb/dist/Utility/StreamUtil';

I am using RavenDB Server v5.4.2

Since my code worked with v.5.2.7 ... it seems there was a change. Is it because of my Server version?

Hi @tzarger

In RavenDB 5.4 client we introduced faster way of streaming using jsonl.

Please notice that you are using very old version of RavenDB server (relased on 2022/09/01) which lacks this feature.

I'd suggest either:

  • upgrade your server to newer version (suggested)
  • disable jsonlp support in ravendb node.js client using:
convensions.useJsonlStreaming = false;

On your DocumentConventions object.

I hope it helps.

@ml054 Thank you for your update. I was suspecting it might be related to the older version I am using.

Are there any known issues upgrading from v5.4.2 to the latest as the server is a production server...

There are no issues with the upgrade that we are aware of.
Note that in general, if you have one server, that won't be a high availability upgrade

@tzarger can we close this issue or there is anything else we can help?