1MONGOC_URI_GET_MECHANISM_PROPERTIES(l3i)bmonMgOoNcGOC_URI_GET_MECHANISM_PROPERTIES(3)
2
3
4
6 bool
7 mongoc_uri_get_mechanism_properties (const mongoc_uri_t *uri,
8 bson_t *properties /* OUT */);
9
11 • uri: A mongoc_uri_t.
12
13 • properties: An uninitialized bson_t.
14
16 Fetches the "authMechanismProperties" options set on this mongoc_uri_t.
17 The out-parameter properties should be an uninitialized, stack-allo‐
18 cated bson_t. It is statically initialized with bson_init_static() to
19 point to the internal data of uri, so its contents must not be modified
20 and it becomes invalid after uri is destroyed.
21
23 If no "authMechanismProperties" have been set on uri, this functions
24 returns false and properties remains uninitialized.
25
27 mongoc_uri_t *uri;
28 bson_t props;
29
30 uri = mongoc_uri_new (
31 "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI"
32 "&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true");
33
34 if (mongoc_uri_get_mechanism_properties (uri, &props)) {
35 char *json = bson_as_canonical_extended_json (&props, NULL);
36 printf ("%s\n", json);
37 bson_free (json);
38 } else {
39 printf ("No authMechanismProperties.\n");
40 }
41
42 This code produces the output:
43
44 { "SERVICE_NAME" : "other", "CANONICALIZE_HOST_NAME" : "true" }
45
47 MongoDB, Inc
48
50 2017-present, MongoDB, Inc
51
52
53
54
551.25.1 Nov 08,M2O0N2G3OC_URI_GET_MECHANISM_PROPERTIES(3)