undefinedfix
Sign in

Moogose failed to connect to database with root permission

CarLoansKlamath edited in Wed, 28 Sep 2022

I modified mongori in the config file, using the user name and password of root. Then the connection calls back err, and the result is printed as follows:

The user name and password can be guaranteed to be correct. You can successfully enter Mongo's shell from the command line. Here is my connection code

mongoose.connect(mongoURI,{useNewUrlParser:true,useUnifiedTopology: true, autoIndex: false }).then(res=>{
    console.log('MongoDB Connected...');
}).catch((err)=>{
    console.log(mongoURI)
    console.log(err);
    console.log('MongoDB Connect Failed');
});
0 Replies