Hi,
I am new to this and currently just following some tutorials but I get this warning when connecting to my database. I don’t know if it is a node issue or just a general problem and not sure why I am getting the message anyway:
(node:7300) DeprecationWarning: Multiple authentication is prohibited on a connected client, please only authenticate once per MongoClient
at c:\Node Mongo and Angular\MongoDBTesting\db_connect_url.js:15:12
at c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\utils.js:697:5
at c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\mongo_client.js:258:7
at connectCallback (c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\operations\connect.js:365:5)
at c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\operations\connect.js:555:5
at connectHandler (c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\core\sdam\topology.js:298:43)
at cb (c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\core\sdam\topology.js:682:26)
at c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\cmap\connection_pool.js:350:13
at handleOperationResult (c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\core\sdam\server.js:558:5)
at MessageStream.messageHandler (c:\Node Mongo and Angular\MongoDBTesting\node_modules\mongodb\lib\cmap\connection.js:277:5)
My nodejs code is as follows:
var MongoClient = require('mongodb').MongoClient
var url = 'mongodb://Paul:MyPassword@localhost:27017/testDb'
var client = new MongoClient(url, {
useUnifiedTopology: true
});
client.connect(function(err, db){
if(err){
console.log("Connection failed" + err.message);
}
else{
console.log("Connected");
db.logout(function(err, result){
if(!err){
console.log("Logged out");
}
db.close();
console.log("Connection closed");
});
}
});
I can’t seem to find an answer via google, so I don’t know if it is something I should be concerned about or not.
Can anyone help? Even a link to an explanation would help as my google search has produced nothing.
Thanks.