node.js - How to create DB users in mongodb using mongoose -


i can create users mongo shell using createuser() function. have requirement need create users gui(using nodej,express).im using mongoose multiple connections db. cant see functions in mongoose. there functions or packages supports features createuser, delete user this.

connect using db = mongoose.mongo.mongoclient('mongodb://'+username+':'+passwor‌​d+'@localhost/dbtoco‌​nnect, function(err, db){});

using db object admin access first. can use admin collection , authenticate using admin username , password using admin_db.authenticate('adminusername', 'password'); using adduser function can add users


Comments

Popular posts from this blog

java - MvcUriComponentsBuilder and inccorect binding in Spring MVC -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -

c# - LINQ IQueryable returning same rows with skip and take -