Skip to content

Commit ea981cc

Browse files
committed
CDRIVER-1928 show URL-encoded Unix sockets in docs
1 parent 1a0f9a9 commit ea981cc

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

doc/mongoc_advanced_connections.page

+4-6
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@ main (int argc,
8888
<section id="unix-socket">
8989
<info><link type="guide" xref="index#advanced-connections" /></info>
9090
<title>Connecting to a UNIX Domain Socket</title>
91-
<p>On UNIX-like systems, the C Driver can connect directly to a MongoDB server using a UNIX domain socket. Simply pass the path to the socket, which <em>must</em> be suffixed with <code>.sock</code>.</p>
92-
93-
<screen><code><![CDATA[mongoc_uri_t *uri = mongoc_uri_new ("mongodb:///tmp/mysocket.sock");]]></code></screen>
94-
<note style="warning">
95-
<p>Connecting directly to a UNIX domain socket is not a common practice.</p>
96-
</note>
91+
<p>On UNIX-like systems, the C Driver can connect directly to a MongoDB server using a UNIX domain socket. Pass the URL-encoded path to the socket, which <em>must</em> be suffixed with <code>.sock</code>. For example, to connect to a domain socket at <code>/tmp/mongodb-27017.sock</code>:</p>
92+
<screen><code><![CDATA[mongoc_uri_t *uri = mongoc_uri_new ("mongodb://%2Ftmp%2Fmongodb-27017.sock");]]></code></screen>
93+
<p>Include username and password like so:</p>
94+
<screen><code><![CDATA[mongoc_uri_t *uri = mongoc_uri_new ("mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock");]]></code></screen>
9795
</section>
9896

9997
<section id="SSL">

doc/mongoc_uri_new.page

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ mongoc_uri_new (const char *uri_string)
4545
<p><code mime="text/x-csrc">"mongodb://kerberosuser%[email protected]/?authMechanism=GSSAPI"</code></p>
4646
<p><code mime="text/x-csrc">"mongodb://[::1]:27017/"</code></p>
4747
<p><code mime="text/x-csrc">"mongodb://10.0.0.1:27017,10.0.0.1:27018,[::1]:27019/?ssl=true"</code></p>
48-
<p><code mime="text/x-csrc">"mongodb:///tmp/mongodb-27017.sock"</code></p>
48+
<p><code mime="text/x-csrc">"mongodb://%2Ftmp%2Fmongodb-27017.sock"</code></p>
49+
<p><code mime="text/x-csrc">"mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock"</code></p>
4950
<p><code mime="text/x-csrc">"mongodb://localhost,[::1]/mydb?authSource=mydb"</code></p>
5051
</section>
5152

0 commit comments

Comments
 (0)