Mongodb Get User

By Yashwant Chavan, Views 1220, Date 10-Oct-2016

In this tutorial we will learn how to get the User Information using mongodb db.getUser() method.

tags mongodb

Mongodb Get User - db.getUser()

Returns user information for a respected user, Refer following getUser() method syntax.

db.getUser(username);

Mongodb Get User Shell Command Example

> use technicalkeeda
switched to db technicalkeeda
> db.getUser("scott")
{
        "_id" : "technicalkeeda.scott",
        "user" : "scott",
        "db" : "technicalkeeda",
        "customData" : {
                "employeeId" : 9999,
                "employeeName" : "Yashwant",
                "dept" : "IT"
        },
        "roles" : [
                {
                        "role" : "readWrite",
                        "db" : "technicalkeeda"
                }
        ]
}
>
Yashwant Chavan

Yashwant Chavan

Hi there! I am founder of technicalkeeda.com and programming enthusiast. My skills includes Java,J2EE, Spring Framework, Nodejs, PHP and lot more. If you have any idea that you would want me to develop? Lets connect: yashwantchavan@gmail.com