MongoDB Get User

By Yashwant Chavan, Views 1222, Last updated on 01-Mar-2019

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.


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"


Hi there! I am founder of 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[at][]