I can create users from mongo shell using createUser() function. but i have a requirement that i need to create users from GUI(using nodej,express).Im using mongoose for multiple connections to db. i cant see any functions in mongoose. is there any functions or packages that supports features like createUser, delete user like this.
connect using db = mongoose.mongo.MongoClient('mongodb://'+username+':'+password+'@localhost/dbtoconnect, function(err, db){});
using db object get admin access first. Then you can use admin collection and authenticate using admin username and password using admin_db.authenticate('adminusername', 'password');
using addUser
function you can add the users
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.