Previously I could use db.authenticate(String username, char[] password)
method. With 2.13.0, how can I achieve this?
相关问题
- MongoDB can not create unique sparse index (duplic
- java client program to send digest authentication
- Spring Data MongoDB - lazy access to some fields
- Golang mongodb aggregation
- PHP persistent login - Do i reissue a cookie after
相关文章
- mongodb有没有什么办法禁止读取数据的时候进行缓存
- mongodb-aggregate聚合查询分组后如何获得多字段
- mongodb error: how do I make sure that your journa
- How to track MongoDB requests from a console appli
- MongoError: cannot infer query fields to set, path
- Pymongo $in Query Not Working
- django.core.exceptions.ImproperlyConfigured: '
- User.Identity.IsAuthenticated vs WebSecurity.IsAut
Use
and create mongoclient using mongocredentials
com.mongodb.MongoClient.MongoClient(List seeds, List credentialsList, MongoClientOptions options)
We can have user-password based authentication for databases, in that case we need to provide authorization credentials like below for new version.
If you are using older versions, you need to provide authentication details after getting the DB object like below
There is no replacement for db.authenticate(). The driver will use the credentials provided and make sure the connections are authenticated as they are created.
Based on this mongodb-user discussion the Java Driver team is open to discussions on what the real need for the db.authenticate(...) method.