Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-6230

How do stream over a large dataset? I only found the cluster.query() which returns promise

    XMLWordPrintable

Details

    Description

      I have been looking for a way to stream over the data using the emitter that is emitted by the QueryExecuter class (https://github.com/couchbase/couchnode/blob/3d0b7e8ef249ac2c912845320e5742b6fa6ff197/lib/queryexecutor.js#L9)
      but reading the docs, I could not find that method to use this class. On going through the Cluster class
      (https://github.com/couchbase/couchnode/blob/3d0b7e8ef249ac2c912845320e5742b6fa6ff197/lib/cluster.js#L228)
      I realized that the method mentioned here, cluster.query(), is a wrapper that is using the emitter internally and giving the complete dataset.

      I want to get the functionality mentioned in the code snippet in the docs. Also, I believe this snippet is misleading since the result receives a promise since the cluster.query is an async function and I get error result.on is not available
      var result = cluster.query(
      'SELECT x.* FROM `default` WHERE x.Type="User"');
      result.on('row', (row) =>

      { // handle the row var name = row.name; }

      );

      Reporter: Divyanshu Bhatnagar
      E-mail: bhatnagardivyanshu@gmail.com

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              richard.smedley Richard Smedley
              docsite-collector Docs Site Collector
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty