1. 启动报错
failed to access class com.mongodb.client.internal.MongoClientDelegate from class com.mongodb.Mongo (com.mongodb.client.internal.MongoClientDelegate and com.mongodb.Mongo are in unnamed module of loader 'app')
解决思路:检查springboot版本和spring-boot-starter-data-mongodb版本是否一致。
2.查询时权限报错
Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server localhost:27017
解决思路:
1.查看mongodb登录用户的权限。
2.在请求uri里增加参数。
?authSource=admin