Skip to content

Commit a75f4c0

Browse files
committed
CDRIVER-506 update read preferences docs
1 parent 8855823 commit a75f4c0

5 files changed

+13
-6
lines changed

doc/mongoc_client_set_read_prefs.page

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
mongoc_client_set_read_prefs (mongoc_client_t *client,
1717
const mongoc_read_prefs_t *read_prefs);]]></code></synopsis>
1818
<p>Sets the default read preferences to use with future operations upon <code>client</code>.</p>
19+
<p>The global default is to read from the replica set primary.</p>
20+
<p>Please see the MongoDB website for a description of <link href="http://docs.mongodb.org/manual/core/read-preference/">Read Preferences</link>.</p>
1921
</section>
2022

2123
<section id="parameters">

doc/mongoc_collection_set_read_prefs.page

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ mongoc_collection_set_read_prefs (mongoc_collection_t *collection,
2929
<section id="description">
3030
<title>Description</title>
3131
<p>Sets the default read preferences to use for operations on <code>collection</code> not specifying a read preference.</p>
32+
<p>The global default is MONGOC_READ_PRIMARY: if the client is connected to a replica set it reads from the primary, otherwise it reads from the current MongoDB server.</p>
33+
<p>Please see the MongoDB website for a description of <link href="http://docs.mongodb.org/manual/core/read-preference/">Read Preferences</link>.</p>
3234
</section>
3335

3436
</page>

doc/mongoc_database_set_read_prefs.page

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ mongoc_database_set_read_prefs (mongoc_database_t *database,
2020
const mongoc_read_prefs_t *read_prefs);
2121
]]></code></synopsis>
2222
<p>This function sets the default read preferences to use on operations performed with <code>database</code>. Collections created with <link xref="mongoc_database_get_collection">mongoc_database_get_collection()</link> after this call will inherit these read preferences.</p>
23+
<p>The global default is MONGOC_READ_PRIMARY: if the client is connected to a replica set it reads from the primary, otherwise it reads from the current MongoDB server.</p>
24+
<p>Please see the MongoDB website for a description of <link href="http://docs.mongodb.org/manual/core/read-preference/">Read Preferences</link>.</p>
2325
</section>
2426

2527
<section id="parameters">

doc/mongoc_read_mode_t.page

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
<section id="description">
2626
<title>Description</title>
27-
<p>This enum describes how reads should be dispatched. Please see the MongoDB website for a description of <link href="http://docs.mongodb.org/manual/core/read-preference/">Read Preferences</link>.</p>
27+
<p>This enum describes how reads should be dispatched. The default is MONGOC_READ_PRIMARY.</p>
28+
<p>Please see the MongoDB website for a description of <link href="http://docs.mongodb.org/manual/core/read-preference/">Read Preferences</link>.</p>
2829
</section>
2930

3031
</page>

doc/mongoc_read_prefs_t.page

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<section id="description">
1414
<title>Synopsis</title>
1515
<p><link xref="mongoc_read_prefs_t">mongoc_read_prefs_t</link> provides an abstraction on top of the MongoDB connection read prefences. It allows for hinting to the driver which nodes in a replica set should be accessed first.</p>
16-
<p>You can specify a read preference mode on connection objects, database objects, collection objects, or per-operation. Generally, it makes the most sense to stick with *READ_PRIMARY*. All of the other modes come with caveats that won't be covered in great detail here.</p>
16+
<p>You can specify a read preference mode on connection objects, database objects, collection objects, or per-operation. Generally, it makes the most sense to stick with the global default, <code>MONGOC_READ_PRIMARY</code>. All of the other modes come with caveats that won't be covered in great detail here.</p>
1717
</section>
1818

1919
<section id="read-modes">
@@ -25,19 +25,19 @@
2525
</tr>
2626
<tr>
2727
<td><p>MONGOC_READ_SECONDARY</p></td>
28-
<td><p>All operations read from the secondary members of the replica set.</p></td>
28+
<td><p>All operations read from among the nearest secondary members of the replica set.</p></td>
2929
</tr>
3030
<tr>
3131
<td><p>MONGOC_READ_PRIMARY_PREFERRED</p></td>
3232
<td><p>In most situations, operations read from the primary but if it is unavailable, operations read from secondary members.</p></td>
3333
</tr>
3434
<tr>
3535
<td><p>MONGOC_READ_SECONDARY_PREFERRED</p></td>
36-
<td><p>In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary.</p></td>
36+
<td><p>In most situations, operations read from among the nearest secondary members, but if no secondaries are available, operations read from the primary.</p></td>
3737
</tr>
3838
<tr>
3939
<td><p>MONGOC_READ_NEAREST</p></td>
40-
<td><p>Operations read from the nearest member of the replica set, irrespective of the member’s type.</p></td>
40+
<td><p>Operations read from among the nearest members of the replica set, irrespective of the member’s type.</p></td>
4141
</tr>
4242
</table>
4343
</section>
@@ -56,7 +56,7 @@
5656
<item><p>nearest</p></item>
5757
</list>
5858

59-
<p>Tags are not compatible with primary and, in general, only apply when selecting a secondary member of a set for a read operation. However, the nearest read mode, when combined with a tag set will select the nearest member that matches the specified tag set, which may be a primary or secondary.</p>
59+
<p>Tags are not compatible with <code>MONGOC_READ_PRIMARY</code> and, in general, only apply when selecting a secondary member of a set for a read operation. However, the nearest read mode, when combined with a tag set will select the nearest member that matches the specified tag set, which may be a primary or secondary.</p>
6060

6161
<p>All interfaces use the same member selection logic to choose the member to which to direct read operations, basing the choice on read preference mode and tag sets.</p>
6262
</section>

0 commit comments

Comments
 (0)