Create user using mongo db instead of meteor Accounts

Create user using mongo db instead of meteor Accounts

I will sound extremely noob but I’ve gotten used to meteor for the past 3 years and I’ve never created a user using Mongo. Because of this im just used to Accounts.createUser(). Is there a similar quick way to create users in Mongo ? I’m making cross platform app and I would prefer if the accounts were not managed by meteor.

like something as easy as

import mongoUserCreator from ‘miraculousNpmPackage’;

mongoUserCreator.makeUSer(email : blablah , password : blahblah );

Are you looking for this ?
https://docs.mongodb.com/manual/tutorial/create-users/

db.createUser({
    user: "reportsUser",
    pwd: "12345678",
    roles: [
       { role: "read", db: "reporting" },
       { role: "read", db: "products" },
       { role: "read", db: "sales" },
       { role: "readWrite", db: "accounts" }
    ]
  })

That may do it, haven’t tried it though

Or you can try to hook passport.js somewhere, but it seems easier said than done…