Does mongoose.mongo.MongoClient.connect () work without mongo shell?

I connect to mongo servers that are not local. I use mongoose. And at some point I needed to connect to the mongo native driver, so I do it like:

mongoose.mongo.MongoClient.connect(uri, function (err, conn) {});

but connan object null.

Recently, I changed the structure of the servers, and now all the mongo databases are deleted, and on my new node machines I do not have the mongo shell installed at all ... At first everything worked fine, and the uri connection was:

mongodb://x.x.x.x:27017/database,mongodb://y.y.y.y,mongodb://z.z.z.z

where x.x.x.x:27017was the main one, after some time due to a break in the initial primary, a new primary element was selected, and now I start with the same uri, but the connection object null, and I don't know why ...

is there anyone who had a similar problem? or maybe a solution or an idea ....

+4
1

uri :

:

mongodb://x.x.x.x:27017/database,mongodb://y.y.y.y,mongodb://z.z.z.z,{options}

MongoClient :

mongodb://x.x.x.x:27017,y.y.y.y:27017,z.z.z.z:27017/database?opt1=o1&opt2=o2

: MongoClient.connect

+2

All Articles