i need set remote connection to MongoDB, but i need make it via mongojs.
var docdbconn = mongojs('mongodb+srv://mylogin:mypassword@cluster0-m1s1a.mongodb.net/nameofdatabase?retryWrites=true');
and usually i get next error:
MongoError: failed to connect to server [cluster0-m1s1a.mongodb.net:27017] on first connect [MongoError: getaddrinfo ENOTFOUND cluster0-m1s1a.mongodb.net cluster0-m1s1a.mongodb.net:27017]
I found a solution, so i used another string connection for MongoDB 3.4+ and it helped me.
var docdbconn = mongojs("mongodb://nickname:password@cluster0-shard-00-00-m1s1a.mongodb.net:27017,cluster0-shard-00-01-m1s1a.mongodb.net:27017,cluster0-shard-00-02-m1s1a.mongodb.net:27017/databasename?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true");