After setting permissions in MongoDB, if you use the common command again, the message "$ Err": "Not authorized for query on admin. system. namespaces "indicates that you do not have permission to perform the operation. you can solve the problem as follows:
Assume that the user set previously is root and the password is admin.
> Use adminswitched to DB admin> dB. adduser ("root", "admin") {"user": "root", "readonly": false, "PWD": "bde0d84f6749c235a6b4e36d945eb666", "_ id ": objectid ("515e662430d89f61f6991c91")}> show collectionsfri APR 05 13:50:36. 685 JavaScript Execution failed: Error: {"$ Err": "Not authorized for query on admin. system. namespaces "," code ": 16550} At src/Mongo/Shell/query. JS: l128>
Note:When you use the show collections command above, an error is returned. Because you do not have the permission. Perform the following operations:
Verify the current user:>
DB. Auth ("root", "admin ");1
Note:If 1 is returned, the verification is successful. If 0 is returned, the verification fails.
Enter the following command: Show collections to view the collection under Admin.> Show collectionssystem. indexessystem. Users