I need to list all the users who have access to a MongoDB, but via PHP. Basically the same as if you were do the following from the mongo shell:
> use test
switched to db test
> show users
{
"_id" : ObjectId("51f74b1c9d8036288ae01e98"),
"user" : "admin",
"pwd" : "cc4fa5214a55925052f2892be6feb470",
"roles" : [
"readWrite",
"dbAdmin"
]
}
{
"_id" : ObjectId("52085c1dc9f60326cb20cb37"),
"user" : "user_name",
"pwd" : "ec416be9a5e17fbe48a7ceb93e63ecba",
"roles" : [
"readWrite",
"dbAdmin"
]
}
{
"_id" : ObjectId("52085c35c9f60326cb20cb38"),
"user" : "test_user",
"pwd" : "bf7a0adf9822a3379d6dfb1ebd38b92e",
"roles" : [
"readWrite"
]
}
I have tried using the execute command builtin to PHP without any luck. Anyone have any ideas?