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

Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed. Failed to make backend connection.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Critical - P2 Critical - P2
    • None
    • None
    • None
    • google cloud platform and bitnami

    Description

      mongo save causes error. Insert doesn't. I want to use save

      My client javascript:

      xmlhttp.open("POST", "http://35.197.106.195");
      xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
      xmlhttp.send(JSON.stringify(myData));

      "POST /HTTP/1.1" 502 380

      I'm running server app by executing: node app.js . where app.js has the following code:

      var port = 3000;
      app.post("/", (req, res) =>
       
      var buyer = new Buyer({
              email: buyerObj[0].email,
               .
               .
          }).save()
          .then(item => {
              console.log("saved to database")
              res.send("record has been saved");
          })
          .catch(err => {
              console.log("err = " + err);
              res.status(400).send("unable to save 
              to database" + err);
          });
        });
       
      which I changed to 
       
      var buyers = {
      email: buyerObj[0].email,
      .
      .
      };
      mycollections.insert(buyers);
      res.send("record saved");
      

      This took care of the 502 error. I also had to add:
      ?authSource=admin to the connection string to make insert work.

      I want to be able to use save() and not insert.

      Attachments

        Activity

          People

            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            larryscheib larry scheib
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: