{
    "module_completions": [
        {
            "trigger": "MongoClient.connect(connectionString, function(err, db)",
            "name": "MongoClient.connect",
            "type": "method", // maybe also "event", "class" or "property"
            "desc": "MongoClient or how to connect in a new and better way http://mongodb.github.io/node-mongodb-native/driver-articles/mongoclient.html <div class="section" id="the-url-connection-format">
<h2>The URL connection format<a class="headerlink" href="#the-url-connection-format" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><pre>mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]</pre>
</div>
<p>The URL format is unified across official drivers from 10gen with some
options not supported on some drivers due to natural reasons. The ones
not supported by the Node.js driver are left out for simplicities sake.</p>
<div class="section" id="basic-parts-of-the-url">
<h3>Basic parts of the url<a class="headerlink" href="#basic-parts-of-the-url" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><strong>mongodb://</strong> is a required prefix to identify that this is a string
in the standard connection format.</li>
<li><strong>username:password@</strong> is optional. If given, the driver will attempt
to login to a database after connecting to a database server.</li>
<li><strong>host1</strong> is the only required part of the URI. It identifies either
a hostname, IP address, or unix domain socket</li>
<li><strong>:portX</strong> is optional and defaults to :27017 if not provided.</li>
<li><strong>/database</strong> is the name of the database to login to and thus is
only relevant if the username:password@ syntax is used. If not
specified the “admin” database will be used by default.</li>
<li><strong>?options</strong> are connection options. Note that if database is absent
there is still a / required between the last host and the ?
introducing the options. Options are name=value pairs and the pairs
are separated by “&amp;”. For any unrecognized or unsupported option, a
driver should log a warning and continue processing. A driver should
not support any options that are not explicitly defined in this
specification. This is in order to reduce the likelihood that
different drivers will support overlapping that differ in small but
incompatible ways (like different name, different values, or
different default value).</li>
</ul>
</div>
<div class="section" id="replica-set-configuration">
<h3>Replica set configuration:<a class="headerlink" href="#replica-set-configuration" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><strong>replicaSet=name</strong><ul>
<li>The driver verifies that the name of the replica set it connects
to matches this name. Implies that the hosts given are a seed
list, and the driver will attempt to find all members of the set.</li>
<li>No default value.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="connection-configuration">
<h3>Connection Configuration:<a class="headerlink" href="#connection-configuration" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><strong>ssl=true|false|prefer</strong><ul>
<li>true: the driver initiates each connections with SSL</li>
<li>false: the driver initiates each connection without SSL</li>
<li>prefer: the driver tries to initiate each connection with SSL, and
falls back to without SSL if it fails.</li>
<li>Default value is false.</li>
</ul>
</li>
<li><strong>connectTimeoutMS=ms</strong><ul>
<li>How long a connection can take to be opened before timing out.</li>
<li>Current driver behavior already differs on this, so the default
must be left to each driver. For new implementations, the default
should be to never timeout.</li>
</ul>
</li>
<li><strong>socketTimeoutMS=ms</strong><ul>
<li>How long a send or receive on a socket can take before timing out.</li>
<li>Current driver behavior already differs on this, so the default
must be left to each driver. For new implementations, the default
should be to never timeout.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="connection-pool-configuration">
<h3>Connection pool configuration:<a class="headerlink" href="#connection-pool-configuration" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><strong>maxPoolSize=n:</strong> The maximum number of connections in the
connection pool<ul>
<li>Default value is 5</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="write-concern-configuration">
<h3>Write concern configuration:<a class="headerlink" href="#write-concern-configuration" title="Permalink to this headline">¶</a></h3>
<p>More detailed information about write concerns can be found at
<a class="reference external" href="http://www.mongodb.org/display/DOCS/getLastError+Command">http://www.mongodb.org/display/DOCS/getLastError+Command</a></p>
<ul class="simple">
<li><strong>w=wValue</strong><ul>
<li>For numeric values above 1, the driver adds { w : wValue } to the
getLastError command.</li>
<li>wValue is typically a number, but can be any string in order to
allow for specifications like “majority”</li>
<li>Default value is 1.</li>
<li>wValue == -1 ignore network errors</li>
<li>wValue == 0 no write acknowledgement</li>
<li>wValue == 1 perform a write acknowledgement</li>
<li>wValue == 2 perform a write acknowledgement across primary and one
secondary</li>
<li>wValue == ‘majority’ perform a write acknowledgement across the
majority of servers in the replicaset</li>
<li>wValue == ‘tag name’ perform a write acknowledgement against the
replicaset tag name</li>
</ul>
</li>
<li><strong>wtimeoutMS=ms</strong><ul>
<li>The driver adds { wtimeout : ms } to the getlasterror command.</li>
<li>Used in combination with w</li>
<li>No default value</li>
</ul>
</li>
<li><strong>journal=true|false</strong><ul>
<li>true: Sync to journal.</li>
<li>false: the driver does not add j to the getlasterror command</li>
<li>Default value is false</li>
</ul>
</li>
<li><strong>fsync=true|false</strong><ul>
<li>true: Sync to disk.</li>
<li>false: the driver does not add fsync to the getlasterror command</li>
<li>Default value is false</li>
<li>If conflicting values for fireAndForget, and any write concern are
passed the driver should raise an exception about the conflict.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="auth-options">
<h3>Auth options<a class="headerlink" href="#auth-options" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><strong>authSource=string:</strong> Used when the user for authentication is
stored in another database using indirect authentication.<ul>
<li>Default value is null</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="read-preference">
<h3>Read Preference<a class="headerlink" href="#read-preference" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><strong>slaveOk=true|false:</strong> Whether a driver connected to a replica set
will send reads to slaves/secondaries.<ul>
<li>Default value is false</li>
</ul>
</li>
<li><strong>readPreference=enum:</strong> The read preference for this connection. If
set, it overrides any slaveOk value.<ul>
<li>Enumerated values:</li>
<li>primary</li>
<li>primaryPreferred</li>
<li>secondary</li>
<li>secondaryPreferred</li>
<li>nearest</li>
<li>Default value is primary</li>
</ul>
</li>
<li><strong>readPreferenceTags=string.</strong> A representation of a tag set as a
comma-separated list of colon-separated key-value pairs, e.g.
<strong>dc:ny,rack:1</strong>. Spaces should be stripped from beginning and end of
all keys and values. To specify a list of tag sets, using multiple
readPreferenceTags, e.g.
<strong>readPreferenceTags=dc:ny,rack:1&amp;readPreferenceTags=dc:ny&amp;readPreferenceTags=</strong><ul>
<li>Note the empty value, it provides for fallback to any other
secondary server if none is available</li>
<li>Order matters when using multiple readPreferenceTags</li>
<li>There is no default value</li>
</ul>
</li>
</ul>
</div>
</div>"
        }
    ]
}