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

Replset events no longer firing after upgrade from 3.1.15 to 3.4.1

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.1
    • Component/s: MongoDB 3.4
    • Environment:
      node:11-alpine

      Replset events are no longer emitted after upgrade from 3.1.15 to 3.4.1 (and also 3.3.1). In particular, the "left" event.

       

      // connect function
      this.mainClient = await MongoClient.connect(settings.db.url, options);        this.mainDB = this.mainClient.db(settings.db.name);
      const onLeft = (event: any) => {            
          logger.error(`Lost connection to mongodb replica: ${event}.`);
      };
      this.mainClient.on("left", onLeft);
      

       

      Options are:

       

      { 
       useNewUrlParser: true,
       useUnifiedTopology: true,
       auth: { user: 'notrealuser', password: 'notrealpassword' },
       replicaSet: 'ReplSet',
       readPreference: 'primaryPreferred' 
      }

       

      Running in the node11:alpine docker image.

      Tested this by shutting down a single instance replset and bringing it back up on version 3.1.15 and 3.4.1 with identical code. In 3.1.15 the event fires but in 3.4.1 it does not.

       

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            david.mitchell@ibm.com David Mitchell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: