您的位置:首页 > 编程语言 > Go语言

区分连接是mongod 还是mongos 的方式 或者副本集

2016-02-03 15:56 561 查看
db.isMaster()

Detect Connections to
mongos Instances

To detect if the MongoDB instance that your client is connectedto is
mongos, use the

isMaster command. When aclient connects to a

mongos,
isMaster returnsa document with a
msg field that holds the stringisdbgrid. For example:{
"ismaster" : true,
"msg" : "isdbgrid",
"maxBsonObjectSize" : 16777216,
"ok" : 1
}

If the application is instead connected to a
mongod, thereturned document does not include the
isdbgrid string.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: