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