1MONGOC_DATABASE_SET_READ_PREFS(3) libmongoc MONGOC_DATABASE_SET_READ_PREFS(3)
2
3
4
6 mongoc_database_set_read_prefs - mongoc_database_set_read_prefs()
7
9 void
10 mongoc_database_set_read_prefs (mongoc_database_t *database,
11 const mongoc_read_prefs_t *read_prefs);
12
13 This function sets the default read preferences to use on operations
14 performed with database. Collections created with mongoc_data‐
15 base_get_collection() after this call will inherit these read prefer‐
16 ences.
17
18 The global default is MONGOC_READ_PRIMARY: if the client is connected
19 to a replica set it reads from the primary, otherwise it reads from the
20 current MongoDB server.
21
22 Please see the MongoDB website for a description of Read Preferences.
23
25 · database: A mongoc_database_t.
26
27 · read_prefs: A mongoc_read_prefs_t.
28
30 MongoDB, Inc
31
33 2017-present, MongoDB, Inc
34
35
36
37
381.16.2 Feb 25, 2020MONGOC_DATABASE_SET_READ_PREFS(3)