Definition定义
Mongo.getURI()-
Returns:返回The connection string for the current active connection.当前活动连接的连接字符串。See the Connection Strings for more information.有关更多信息,请参阅连接字符串。
Syntax语法
The command takes the following form:该命令采用以下形式:
db.getMongo().getURI()
You can use this method to return a URI string for a connection, which you can then use to create a new 您可以使用此方法返回连接的URI字符串,然后可以使用该字符串创建新的Mongo() instance:Mongo()实例:
new Mongo(db.getMongo().getURI())Example示例
To return the current connection string, enter the following:要返回当前连接字符串,请输入以下内容:
db.getMongo().getURI()
mongodb://127.0.0.1:27019/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.1.4