---
name: "mongoc_uri_get_mechanism_properties"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_uri_get_mechanism_properties"
---

# mongoc\_uri\_get\_mechanism\_properties(3)

## SYNOPSIS

```
bool
mongoc_uri_get_mechanism_properties (const mongoc_uri_t *uri,
                                     bson_t *properties /* OUT */);
```

## PARAMETERS

- •

  **uri**: A *mongoc\_uri\_t*.

- •

  **properties**: An uninitialized *bson\_t*.

## DESCRIPTION

Fetches the "authMechanismProperties" options set on this *mongoc\_uri\_t*. The out-parameter **properties** should be an uninitialized, stack-allocated *bson\_t*. It is statically initialized with *bson\_init\_static()* to point to the internal data of **uri**, so its contents must not be modified and it becomes invalid after **uri** is destroyed.

## RETURNS

If no "authMechanismProperties" have been set on **uri**, this functions returns false and **properties** remains uninitialized.

## EXAMPLE

```
mongoc_uri_t *uri;
bson_t props;
uri = mongoc_uri_new (
   "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI"
   "&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true");
if (mongoc_uri_get_mechanism_properties (uri, &props)) {
   char *json = bson_as_canonical_extended_json (&props, NULL);
   printf ("%s\n", json);
   bson_free (json);
} else {
   printf ("No authMechanismProperties.\n");
}
```

This code produces the output:

```
{ "SERVICE_NAME" : "other", "CANONICALIZE_HOST_NAME" : "true" }
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
