Reputation: 163
Using the C# MongoDb driver, is there a way to query a server to find out if it was started with:
mongod --auth
or just mongod
?
Thanks.
Upvotes: 1
Views: 254
Reputation: 26
There is a ticket on the MongoDB tracker indicating the getCmdLineOpts command can be used to get the auth mode of the server.
db.runCommand("getCmdLineOpts")
returns
{
"argv" : [
"mongod",
"--config",
"mongodb.conf"
],
"parsed" : {
"auth" : "true",
"config" : "mongodb.conf",
...
},
"ok" : 1
}
If --auth
was passed on the command line it will appear in the argv
and parsed
nodes; if it was set in mongodb.conf it will only appear in the parsed
node.
Upvotes: 1