增加权限:
Linux
进入mongo
use admin
db.createUser({user: "admin",pwd: "admin",roles: [ { role: "userAdminAnyDatabase", db: "admin" },{ role: "dbAdminAnyDatabase", db: "admin" },{ role: "readWriteAnyDatabase", db: "admin" } ]})
SpringBoot
spring: data: mongodb: host: ip port: 27017 username: admin password: 123456 authentication-database: admin database: myDatabase