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