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

Cursor.clone does not return legacy version of cursor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • legacy-5.0.0
    • Affects Version/s: legacy-4.0.0, legacy-4.0.1
    • Component/s: None
    • 2
    • Not Needed
    • Not Needed

      What problem are you facing?

      FindCursor.clone/AggCursor.clone do not return legacy versions so callback style usage after a clone stops working as the instance is a promise only version.

      What driver and relevant dependency versions are you using?

      mongodb-legacy package

      Steps to reproduce?

      The second toArray never invokes the callback

      const cursor = coll.find({});
            this.defer(() => cursor.close());
      
            cursor.toArray((err, docs) => {
              expect(err).to.not.exist;
              expect(docs).to.have.length(6);
              expect(cursor).property('closed').to.be.true;
      
              const clonedCursor = cursor.clone();
              this.defer(() => clonedCursor.close());
      
              clonedCursor.toArray((err, docs) => {
                expect(err).to.not.exist;
                expect(docs).to.have.length(6);
                expect(clonedCursor).property('closed').to.be.true;
                done();
              });
            });
      

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: