1MONGOC_CLIENT_SELECT_SERVER(3)     libmongoc    MONGOC_CLIENT_SELECT_SERVER(3)
2
3
4

NAME

6       mongoc_client_select_server - mongoc_client_select_server()
7

SYNOPSIS

9          mongoc_server_description_t *
10          mongoc_client_select_server (mongoc_client_t *client,
11                                       bool for_writes,
12                                       const mongoc_read_prefs_t *prefs,
13                                       bson_error_t *error) BSON_GNUC_WARN_UNUSED_RESULT;
14
15       Choose  a  server for an operation, according to the logic described in
16       the Server Selection Spec.
17
18       Use this function only for building a language driver that wraps the  C
19       Driver. When writing applications in C, higher-level functions automat‐
20       ically select a suitable server.
21

PARAMETERS

23client: A mongoc_client_t.
24
25for_writes: Whether to choose a server suitable for writes or reads.
26
27prefs: An optional mongoc_read_prefs_t. If for_writes is true,  prefs
28         must  be NULL. Otherwise, use prefs to customize server selection, or
29         pass NULL to use read preference PRIMARY.
30
31error: An optional location for a bson_error_t or NULL.
32

RETURNS

34       A mongoc_server_description_t that must be freed with mongoc_server_de‐
35       scription_destroy. If no suitable server is found, returns NULL and er‐
36       ror is filled out.
37

AUTHOR

39       MongoDB, Inc
40
42       2017-present, MongoDB, Inc
43
44
45
46
471.20.0                           Nov 18, 2021   MONGOC_CLIENT_SELECT_SERVER(3)
Impressum