how to create user on Mongo Db in windows server

    Posted in Windows Servers on Feb 13, 2020

    Login on the power shell v with dB authentication or without

    For example: $ mongo superadmin -u [Username] -p [Password] --port=35615

    rrr4.png

    Run the following command for user creation:

    rrr5.png

    > use CloudTechtiq     (CloudTechtiq is the dB name on which you assigned the user)
    > db.createUser(
    {
    user: "appuser",
    pwd: "EwQDP4x",
    roles: [ "readWrite", "dbAdmin" ]
    }
    )

    Note: appuser (user name which one you want to define) EwQDP4x (password for user) dbAdmin (User role for database)

    If you want to give the full access of dB server, you can change the role to Root .

    Services Cloudtechtiq offers:

    windows-dedicated-server-hosting.jpg