Use mongoose to connect to the specified database of MongoDB

1. A user created in the admin database in MongoDB that is used to connect to another database myBase;

2. Use mongoose to connect to MongoDB, when the connection address is

mongodb://username:password@my-server/myBase?authSource=admin

3. Unable to connect to the error report, isn"t authSource the source database used to indicate authentication?

4. How do I write the connection address if I want to achieve this?

Mar.23,2021

this problem occurs in the v5.2.0 version of mongoose and has been fixed in the v5.2.1 version of mongoose

Menu