mongodb3.0 Replica Set Build Supplement ~ ~ User Rights for non-admin database
Source: Internet
Author: User
Previously there was a replica set to build mongodb3.0, but the admin database that was used directly was the root of the user. Links: http://blog.csdn.net/tuzongxun/article/details/51723259
Recently you want to move data to a non-admin database, and then re-create the user in the non-admin library, the process is roughly the same as before, but there are some problems when creating the user, mainly on the user roles and permissions. I built the process to refer to the following user rights related blogs: http://blog.csdn.net/tuzongxun/article/details/47420149
Root roles and permissions cannot be used I was expecting it before I tried it, but according to the document above, I thought clusteradmin was OK and the result was not.
Finally, a readwrite user is created, successfully connected and used, and can be successfully operated with java-spring. The user creates the following image:
The Java code writes a simple test class connection query (which can refer to the code in the first link at the beginning), and the result of a successful connection is as follows:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.