nosql - MongoDb C# driver - test authentication mode -
using c# mongodb driver, there way query server find out if started with:
mongod --auth
or mongod
?
thanks.
there ticket on mongodb tracker indicating getcmdlineopts command can used auth mode of server.
db.runcommand("getcmdlineopts")
returns
{ "argv" : [ "mongod", "--config", "mongodb.conf" ], "parsed" : { "auth" : "true", "config" : "mongodb.conf", ... }, "ok" : 1 }
if --auth
passed on command line appear in argv
, parsed
nodes; if set in mongodb.conf only appear in parsed
node.
Comments
Post a Comment