1MONGOC_CLIENT_GET_HANDSHAKE_DESCRIPTlIiMObONmN(oG3nO)gCo_cCLIENT_GET_HANDSHAKE_DESCRIPTION(3)
2
3
4
6 mongoc_server_description_t *
7 mongoc_client_get_handshake_description (mongoc_client_t *client,
8 uint32_t server_id,
9 bson_t *opts,
10 bson_error_t *error)
11 BSON_GNUC_WARN_UNUSED_RESULT;
12
13 Returns a description constructed from the initial handshake response
14 to a server.
15
17 mongoc_client_get_handshake_description() is distinct from
18 mongoc_client_get_server_description().
19 mongoc_client_get_server_description() returns a server description
20 constructed from monitoring, which may differ from the server descrip‐
21 tion constructed from the connection handshake.
22
23 mongoc_client_get_handshake_description() will attempt to establish a
24 connection to the server if a connection was not already established.
25 It will perform the MongoDB handshake and authentication if required.
26
27 Use this function only for building a language driver that wraps the C
28 Driver. When writing applications in C, higher-level functions automat‐
29 ically select a suitable server.
30
31 Single-threaded client behavior
32 Single-threaded clients only have one active connection to each server.
33 The one connection is used for both monitoring and application opera‐
34 tions. However, the server description returned by
35 mongoc_client_get_handshake_description() may still differ from the
36 server description returned by mongoc_client_get_server_description().
37 Notably, if connected to a load balanced cluster, the server descrip‐
38 tion returned by mongoc_client_get_server_description() will describe
39 the load balancer server (mongoc_server_description_type() will return
40 "LoadBalancer"). And the server description returned by
41 mongoc_client_get_handshake_description() will describe the backing
42 server.
43
45 • client: A mongoc_client_t.
46
47 • server_id: The ID of the server. This can be obtained from the server
48 description of mongoc_client_select_server().
49
50 • opts: Unused. Pass NULL.
51
52 • error: An optional location for a bson_error_t or NULL.
53
55 A mongoc_server_description_t that must be freed with
56 mongoc_server_description_destroy(). If a connection has not been suc‐
57 cessfully established to a server, returns NULL and error is filled
58 out.
59
61 • mongoc_client_select_server() To select a server from read prefer‐
62 ences.
63
64 • mongoc_client_get_server_description() To obtain the server descrip‐
65 tion from monitoring for a server.
66
67 • mongoc_server_description_type() To obtain the type of server from a
68 server description.
69
71 MongoDB, Inc
72
74 2017-present, MongoDB, Inc
75
76
77
78
791.25.1 NovM0O8N,GO2C0_2C3LIENT_GET_HANDSHAKE_DESCRIPTION(3)