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 mon‐
22 goc_client_get_server_description. mongoc_client_get_server_description
23 returns a server description constructed from monitoring, which may
24 differ from the server description constructed from the connection
25 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 mon‐
39 goc_client_get_handshake_description may still differ from the server
40 description returned by mongoc_client_get_server_description. Notably,
41 if connected to a load balanced cluster, the server description re‐
42 turned by mongoc_client_get_server_description will describe the load
43 balancer server (mongoc_server_description_type will return "LoadBal‐
44 ancer"). And the server description returned by mongoc_client_get_hand‐
45 shake_description will describe the backing server.
46
48 • client: A mongoc_client_t.
49
50 • server_id: The ID of the server. This can be obtained from the server
51 description of mongoc_client_select_server.
52
53 • opts: Unused. Pass NULL.
54
55 • error: An optional location for a bson_error_t or NULL.
56
58 A mongoc_server_description_t that must be freed with mongoc_server_de‐
59 scription_destroy. If a connection has not been successfully estab‐
60 lished to a server, returns NULL and error is filled out.
61
63 • mongoc_client_select_server To select a server from read preferences.
64
65 • mongoc_client_get_server_description To obtain the server description
66 from monitoring for a server.
67
68 • mongoc_server_description_type To obtain the type of server from a
69 server description.
70
72 MongoDB, Inc
73
75 2017-present, MongoDB, Inc
76
77
78
79
801.21.1 MarM0O2N,GO2C0_2C2LIENT_GET_HANDSHAKE_DESCRIPTION(3)