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 - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -