Reputation: 4090
I'd like to use the MongoClient.Connect(Url) option for connecting from Node and in fact it does work for authenticated connections to the admin database. However, if I try to specify a different database I get an "auth Fails" with code 18.
I think this means that the credentials are only setup on the admin database and, unfortunately, I can't change this arrangement (for now, anyway).
It seems this Url syntax is the direction the driver is heading, so I'd like to use it if possible. Is there a way to use this syntax, authenticate and connect to the admin database, and then get a connection to one of the other databases on the server?
Upvotes: 0
Views: 412
Reputation: 248
I just found out how to do this: You use the instance you get ("admin") to open another database you have access to:
db2 = db.db("name of other name");
See it hidden inside the documentation
Upvotes: 0