node.js - Could anyone explain the difference between the two users in mongodb3.4.5 -


//the first user {     "_id" : "admin.guguji55",     "user" : "guguji55",     "db" : "admin",     "roles" : [         {             "role" : "readwrite",             "db" : "test"         }     ] }  //the second user {     "_id" : "test.guguji66",     "user" : "guguji66",     "db" : "test",     "roles" : [         {             "role" : "readwrite",             "db" : "test"         }     ] } 

i create 2 users,the 'guguji55' not connect test database,but 'guguji66' it.i don't know why.my nodejs connection code below:

mongoclient.connect('mongodb://guguji66:du****kuan****@localhost:27017/test', function(err, db) {}); 

 //the first user     {         "_id" : "admin.guguji55",         "user" : "guguji55",         "db" : "admin",         "roles" : [                 {                         "role" : "readwrite",                         "db" : "test"                 }         ] }  //the second user {         "_id" : "test.guguji66",         "user" : "guguji66",         "db" : "test",         "roles" : [                 {                         "role" : "readwrite",                         "db" : "test"                 }         ] } 

with reference above block created first user (guguji55) admin database. , second user (guguji66) test database. , trying connect test database first user can't.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -