Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1905

$sample with `raw: true` does not return correct number of documents being sampled

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Running `aggregate` with `raw: true` as options and `$sample` in the pipeline only returns the `firstBatch` of 100 documents with the rest missing.

      Code:

      this.collection.aggregate([$sample: 300], \{ raw: true })
         .on('error', this.emit.bind(this, 'error'))
         .on('data', this.push.bind(this))
         .on('end', this.push.bind(this, null));
      

       

      Expected: Either cursor of batches with number of documents being sampled, or, since I am streaming, raw individual buffers of data that matches the number of documents being sampled.

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            irina.shestak@mongodb.com Irina Shestak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: