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);
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

23       · client: A mongoc_client_t.
24
25       · for_writes: Whether to choose a server suitable for writes or reads.
26
27       · prefs: 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 the read preference configured on the client.
30
31       · error: An optional location for a bson_error_t or NULL.
32

RETURNS

34       A  mongoc_server_description_t   that   must   be   freed   with   mon‐
35       goc_server_description_destroy. If no suitable server is found, returns
36       NULL and error is filled out.
37

AUTHOR

39       MongoDB, Inc
40
42       2017-present, MongoDB, Inc
43
44
45
46
471.16.2                           Feb 25, 2020   MONGOC_CLIENT_SELECT_SERVER(3)
Impressum