Mongodb Connection String

论坛 期权论坛     
选择匿名的用户   2021-5-30 01:26   410   0
<div style="direction:ltr">
<div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
  <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"><span style="font-size:14pt">本文档描述定义的</span><span style="font-family:Calibri; font-size:14pt">URI</span><span style="font-size:14pt">格式之间,以及应用程序和</span><span style="font-family:Calibri; font-size:14pt">MongoDB</span><span style="font-size:14pt">实例的连接,参考官方</span><span style="font-family:Calibri; font-size:14pt">MongoDB</span><span style="font-size:14pt">的驱动。</span></p>
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"><span style="font-size:14pt"><br> </span></p>
   <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:华文楷体">原文</span><span lang="en-US" style="font-family:Calibri">  :</span><span lang="zh-CN" style="font-family:华文楷体"><a href="http://docs.mongodb.org/manual/reference/connection-string/#connections-connection-options" rel="noopener noreferrer" target="_blank">http://docs.mongodb.org/manual/reference/connection-string/#connections-connection-options</a></span></p>
   <p style="margin:0in; font-size:14pt"><br> </p>
   <h2 style="margin:0in; font-family:华文楷体; font-size:14pt">标准连接字符串格式</h2>
   <div>
    <br>
   </div>
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"><span style="white-space:pre"></span>本节描述的标准格式连接MongoDBURI用于连接MongoDB数据库服务器。所有官方MongoDB的格式都是相同的驱动程序。对于驱动和驱动的链接文档的列表,看到MongoDB驱动和客户端库(<span style="font-size:12pt"><a href="http://docs.mongodb.org/manual/applications/drivers/" rel="noopener noreferrer" style="font-size:12px" target="_blank">MongoDB Drivers and Client Libraries</a>)</span></p>
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"><br> </p>
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"><span style="color:#666600">以下是标准的链接方式</span></p>
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"><span style="color:#666600"><br> </span></p>
   <p style="margin:0in; font-family:华文楷体; font-size:14pt"></p>
   <pre class="blockcode"><code class="language-csharp">mongodb://[username:password&#64;]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]</code></pre>
   <br>
   <p></p>
   <p></p>
   <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:华文楷体"><strong>参数说明:</strong></span><span lang="en-US" style="font-family:Calibri"></span></p>
   <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:华文楷体"><strong><br> </strong></span></p>
  </div>
</div>
</div>
<blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor">
<div style="direction:ltr">
  <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
   <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
    <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:Calibri">mongodb://</span><span lang="en-US" style="font-family:Calibri"></span><span lang="zh-CN" style="font-family:华文楷体">字符串链接的标准格式</span></p>
    <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:华文楷体"><br> </span></p>
   </div>
  </div>
</div>
<div style="direction:ltr">
  <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
   <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
    <p style="margin:0in; font-size:14pt"><span style="font-family:SimSun">username:password&#64;</span></p>
   </div>
  </div>
</div>
<div style="direction:ltr">
  <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
   <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
    <p style="margin:0in; font-family:华文楷体; font-size:14pt">可选的,一般默认是没有名称和密码的,只有在MongoDB服务器使用了身份验证时才出现。</p>
    <p style="margin:0in; font-family:华文楷体; font-size:14pt"><br> </p>
   </div>
  </div>
</div>
<div style="direction:ltr">
  <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
   <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
    <p style="margin:0in; font-size:14pt"><span style="font-family:SimSun">/database</span></p>
   </div>
  </div>
</div>
<div style="direction:ltr">
  <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
   <div style="width:9.395in; margin-top:0in; margin-left:0in; direction:ltr">
    <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:华文楷体">可选的,如果链接的字符串中包含了验证身份的用户名和密码,则数据库是必须要有的。若没有包含数据库名称,默认是链接</span><span lang="en-US" style="font-family:Calibri">admin</span><span lang="zh-CN" style="font-family:华文楷体">的数据库</span></p>
    <p style="margin:0in; font-size:14pt"><span lang="zh-CN" style="font-family:华文楷体"><br> </span
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP