0

i am using mongo server and on node.js

when trying to use my function to find client by name for the second time i get ther error of "topology was destroyed"

function findClient(Fname,res){
    let query = {name:Fname}
    dbo.collection("clients").find(query).toArray(function(err, result) {
        if (err) throw err;
        console.log(result.name);
        res.send(result)
        db.close();
    });
}
Bill
  • 3,478
  • 23
  • 42
Yarden Adi
  • 45
  • 2
  • 10

1 Answers1

0

Make sure your Firewall is not blocking your requests, might has something to do with your VPN/Proxy if you're in a company's local network.

Similar issue where the problem was related to Firewall

Also you might need to ensure the use and location of db.close()

Same issue where the problem was an 'errant close() call' causing the issue

Hamza Wahabi
  • 43
  • 2
  • 7