Answer the question
In order to leave comments, you need to log in
How to set up connection to mongodb with VPN enabled?
The problem is the following. I am writing a telegram bot. On Linux, I use windscribe as a VPN so that the bot can connect to the telegram server. The problem is that after turning on the VPN with the windscribe connect command, the connection to the database is interrupted by an error
UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connection 0 to localhost:27017 timed out]
mongoose.connect("mongodb://localhost:27017/cuba", {useNewUrlParser: true});
const Place = mongoose.model("Place", placesScheme);
var iataCode = '';
await Place.findOne({name: place_name}, 'iataCode', function (err, doc) {
iataCode = doc.iataCode;
});
return iataCode;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question