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