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

No error receive if using promise

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.2
    • Affects Version/s: 3.3.0
    • Component/s: None

       I don't get any error in the first example but I should. If I use a callback, I get it.

       await server.stop();
       try {
       const r = await db.things.insertOne({ a: 1 }); //no error, r is undefined
       } catch (err) {
       console.log(err); 
       }
       await server.restart();
       const r = await db.things.insertOne({ a: 1 });
       assert(r.insertedCount === 1); //it works
      
       db.things.insertOne({ a: 1 }, (err, result) => {
       if (err) { //"MongoTimeoutError" "Server selection timed out after 10000 ms"
       return reject(err);
       }
       resolve(result);
       })
      

      Node 10.16.0
      "mongodb-topology-manager": "^2.1.0"
      "mongodb": "^3.3.0"
       

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            c_ristinescu@yahoo.com Andrei Cristinescu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: