Skip to content

Commit 13d9247

Browse files
author
Bob Grabar
committed
DOCS-501 review edits
1 parent 3eff93c commit 13d9247

File tree

1 file changed

+70
-64
lines changed

1 file changed

+70
-64
lines changed

draft/administration/connections.txt

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ applications and MongoDB instances in the official MongoDB :doc:`drivers
1212

1313
When you connect to a MongoDB database server, the MongoDB driver creates a
1414
connection object that is instantiated once and then reused for every
15-
operation during the lifetime of the connection. The connection object
15+
operation during the lifetime of the connection.
16+
A single connection object can represent multiple connections to
17+
multiple :program:`mongod` or :program:`mongos` instances.
18+
19+
The connection object
1620
uses the options you specify when creating the connection.
17-
The driver's reuse of the connection object saves on the costs of setup and
21+
The reuse of the connection object saves on the costs of setup and
1822
teardown on connections.
1923

20-
Beginning with the Fall 2012 driver release, MongoDB uses two new connection classes for
24+
Beginning with the Fall 2012 driver releases, MongoDB uses two new connection classes for
2125
the creation of connection objects:
2226

2327
- ``MongoClient``: the standard connection class
@@ -27,24 +31,24 @@ the creation of connection objects:
2731
a separate class for connections to replica sets. See the
2832
:doc:`drivers </applications/drivers>` documentation for details.
2933

30-
In MongoDB versions prior to the Fall 2012 driver release, the connection classes vary from driver
34+
In MongoDB versions prior to the Fall 2012 driver releases, the connection classes vary from driver
3135
to driver.
3236

33-
You connect to a MongoDB database server by starting a :program:`mongod`
34-
instance through a MongoDB :doc:`driver </applications/drivers>` or
35-
through the :program:`mongo` shell.
36-
37-
Upon connection to the server, :program:`mongod` displays logging
37+
When you start a :program:`mongod` or :program:`mongos` instance,
38+
the program displays logging
3839
information and then displays that it is waiting for a client
39-
connections, as shown in the following example.
40+
connection, as shown in the following example.
4041

4142
.. code-block:: none
4243

4344
Wed Nov 21 12:56:58 [websvr] admin web console waiting for connections on port 28017
4445
Wed Nov 21 12:56:58 [initandlisten] waiting for connections on port 27017
4546

46-
By default, MongoDB waits for connections on port 27017. The
47-
:program:`mongod` program runs in either the foreground or background.
47+
By default, MongoDB waits for connections on port 27017.
48+
49+
You make socket connections to running :program:`mongod` or :program:`mongos` instances
50+
through a MongoDB :doc:`driver </applications/drivers>` or
51+
through the :program:`mongo` shell.
4852

4953
.. note:: You *cannot* create a connection through HTTP on port 27017.
5054
Specifically, you *cannot* connect to MongoDB by going to
@@ -67,8 +71,8 @@ The following is the standard URI connection scheme:
6771

6872
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
6973

70-
.. example:: In the following example, a connection issued from a Java
71-
driver logs into two databases in the ``test`` replica set:
74+
.. example:: In the following example, a connection
75+
logs into two members in the ``test`` replica set:
7276

7377
.. code-block:: none
7478

@@ -118,8 +122,8 @@ Connection options are name=value pairs. The pairs are separated by "&".
118122
For backwards compatibility, ``;`` is accepted as a separator. But ``;``
119123
is deprecated.
120124

121-
.. example:: In the following example, a connection issued from a Java
122-
driver uses the ``replicaSet`` and ``connectTimeoutMS`` options.
125+
.. example:: In the following example, a connection
126+
uses the ``replicaSet`` and ``connectTimeoutMS`` options.
123127

124128
.. code-block:: none
125129

@@ -128,31 +132,40 @@ is deprecated.
128132
Replica Set Options
129133
~~~~~~~~~~~~~~~~~~~
130134

131-
.. data:: replicaSet=<name>
135+
.. data:: replicaSet
132136

133-
If the :program:`mongod` is a member of a :term:`replica set`, the
134-
name of the replica set.
137+
Specifies the name of the :term:`replica set`, if the
138+
:program:`mongod` is a member of a replica set.
139+
140+
When connecting to a replica set it is important to give a seed list
141+
of at least two :program:`mongod` instances.
135142

136143
Connection Options
137144
~~~~~~~~~~~~~~~~~~
138145

139-
.. data:: ssl=<true,false,prefer>
146+
.. data:: ssl
140147

141148
``true``: Initiate the connection with SSL.
142149

143150
``false``: Initiate the connection without SSL.
144151

145-
``prefer``: Initiate the connection with SSL, but if that fails initiate without SSL.
152+
.. todo Determine whether ``prefer`` option exists. Check with server
153+
team whether it's possible to do rolling restarts of a cluster to
154+
turn on SSL. Here is the option
155+
``prefer``: Initiate the connection with SSL, but if that fails initiate without SSL.
146156

147157
The default value is ``false``.
148158

149-
.. data:: connectTimeoutMS=<milliseconds>
159+
.. note:: The :data:`ssl` option is not supported by all drivers. For information on your
160+
driver, see the :doc:`drivers </applications/drivers>` documentation.
161+
162+
.. data:: connectTimeoutMS
150163

151164
The time in milliseconds to attempt a connection before timing out.
152165
The default is never to timeout, though different drivers might vary.
153166
See the :doc:`/applications/drivers` documentation.
154167

155-
.. data:: socketTimeoutMS=<milliseconds>
168+
.. data:: socketTimeoutMS
156169

157170
The time in milliseconds to attempt a send or receive on a socket
158171
before the attempt times out. The default is never to timeout, though
@@ -168,29 +181,33 @@ Most drivers handle this for you behind the scenes. Some drivers do not
168181
support connection pools. See the :doc:`/applications/drivers`
169182
documentation.
170183

171-
.. data:: maxPoolSize=<number>
184+
.. data:: maxPoolSize
172185

173186
The maximum number of connections in the connection pool. The default
174187
value is ``100``.
175188

176-
.. data:: minPoolSize=<number>
189+
.. data:: minPoolSize
177190

178-
The minimum number of connections in the connection pool The default
191+
The minimum number of connections in the connection pool. The default
179192
value is ``0``.
180193

181-
.. data:: maxIdleTimeMS=<milliseconds>
194+
.. note:: The :data:`minPoolSize` option is not supported by all
195+
drivers. For information on your driver, see the :doc:`drivers
196+
</applications/drivers>` documentation.
197+
198+
.. data:: maxIdleTimeMS
182199

183200
The maximum number of milliseconds that a connection can remain idle
184201
in the pool before being removed and closed.
185202

186-
.. data:: waitQueueMultiple=<milliseconds>
203+
.. data:: waitQueueMultiple
187204

188205
A multiplier number that is multiplied with the
189206
``maxPoolSize`` setting to give the maximum number of threads allowed
190207
to wait for a connection to become available from the pool. For
191208
default values, see the :doc:`/applications/drivers` documentation.
192209

193-
.. data:: waitQueueTimeoutMS=<milliseconds>
210+
.. data:: waitQueueTimeoutMS
194211

195212
The maximum time in milliseconds that a thread is allowed to wait for
196213
a connection to become available. For
@@ -199,28 +216,15 @@ documentation.
199216
Write Concern Options
200217
~~~~~~~~~~~~~~~~~~~~~
201218

202-
.. data:: fireAndForget=<true|false>
203-
204-
``false``: Sends a :dbcommand:`getLastError` command after
205-
every update to ensure that the update succeeded.
219+
For a full explanation of write concern, see
220+
:ref:`write-operations-write-concern`.
206221

207-
``true``: Does not send a :dbcommand:`getLastError` command after
208-
every update.
222+
.. data:: w
209223

210-
The default value depends on the connection class. Prior to the Fall
211-
2012 driver release, the default value is ``true``, which disables
212-
write concern. For the ``MongoClient`` and ``MongoReplicaSetClient``
213-
classes new in the Fall 2012 driver release the default is ``false``.
214-
215-
For the new ``MongoClient`` and ``MongoReplicaSetClient`` classes, if
216-
you enable ``fireAndForget`` but also enable write concern through
217-
the ``w`` option, MongoDB issues an exception about the conflict.
218-
219-
.. data:: w=<number or string>
220-
221-
Used by the :dbcommand:`getLastError` command either
222-
to configure write concern on members of :term:`replica sets <replica
223-
set>` *or* to disable write concern entirely.
224+
Used by the :dbcommand:`getLastError` command either to configure
225+
write concern on members of :term:`replica sets <replica set>` *or*
226+
to disable write concern entirely. This option can take either a
227+
number or a string as a value.
224228

225229
``0``: Disables write concern. If you disable write concern but
226230
enable the :dbcommand:`getLastError` command's ``journal`` option, the
@@ -233,24 +237,20 @@ Write Concern Options
233237
replicated to the specified number of replica set members, including
234238
the primary. If you set ``w`` to a number that is greater than the
235239
number of set members that hold data, MongoDB waits for the
236-
non-existent members become available, which means MongoDB blocks
237-
indefinitely.
240+
non-existent members become available, which means the write
241+
operation blocks indefinitely.
238242

239243
``majority``: Confirms that write operations have replicated to the
240244
majority of set members.
241245

242246
``-1``: Turns off reporting of network errors.
243247

244-
For the new ``MongoClient`` and ``MongoReplicaSetClient`` classes, if
245-
you enable write concern but also enable ``fireAndForget``, MongoDB
246-
issues an exception about the conflict.
247-
248-
.. data:: wtimeoutMS=<milliseconds>
248+
.. data:: wtimeoutMS
249249

250250
The time in milliseconds to wait for replication to succeed, as
251251
specified in the ``w`` option, before timing out.
252252

253-
.. data:: journal=<true|false>
253+
.. data:: journal
254254

255255
``true``: Sync to journal.
256256

@@ -270,12 +270,10 @@ Write Concern Options
270270
Read Preference Options
271271
~~~~~~~~~~~~~~~~~~~~~~~
272272

273-
.. data:: slaveOk=<true|false>
273+
For a full explanation of read preferences, see
274+
:ref:`replica-set-read-preference`.
274275

275-
Specifies whether a driver connected to a replica set sends reads
276-
to secondaries. The default setting is ``false``.
277-
278-
.. data:: readPreference=<string>
276+
.. data:: readPreference
279277

280278
Specifies the :term:`replica set` read preference for this
281279
connection. This setting overrides any ``slaveOk`` value. The read
@@ -293,7 +291,7 @@ Read Preference Options
293291
The default value is :readmode:`primary`, which sends all read
294292
operations to the replica set's :term:`primary`.
295293

296-
.. data:: readPreferenceTags=<string>
294+
.. data:: readPreferenceTags
297295

298296
Specifies a tag set as a comma-separated list of
299297
colon-separated key-value pairs. For example:
@@ -314,7 +312,7 @@ Read Preference Options
314312
Miscellaneous Configuration
315313
~~~~~~~~~~~~~~~~~~~~~~~~~~~
316314

317-
.. data:: uuidRepresentation=<string>
315+
.. data:: uuidRepresentation
318316

319317
``standard``: The standard binary representation.
320318

@@ -327,6 +325,10 @@ Miscellaneous Configuration
327325
For the default, see the :doc:`drivers </applications/drivers>`
328326
documentation for your driver.
329327

328+
.. note:: The :data:`uuidRepresentation` option is not supported by
329+
all drivers. For information on your driver, see the :doc:`drivers
330+
</applications/drivers>` documentation.
331+
330332
.. _connections-connection-examples:
331333

332334
Examples
@@ -354,6 +356,10 @@ password ``moon``:
354356

355357
Connect to a UNIX domain socket:
356358

359+
.. note:: Not all drivers support UNIX domain sockets. For information
360+
on your driver, see the :doc:`drivers </applications/drivers>`
361+
documentation.
362+
357363
.. code-block:: none
358364

359365
mongodb:///tmp/mongodb-27017.sock

0 commit comments

Comments
 (0)