mongoc_client_set_ssl_opts (mongoc_client_t        *client,
                            const mongoc_ssl_opt_t *opts);

Sets the SSL options to use when connecting to SSL enabled MongoDB servers.

Beginning in version 1.2.0, once a client has any SSL options set, all connections use SSL, even if "ssl=true" is omitted from the MongoDB URI. Before, SSL options were ignored unless "ssl=true" was included in the URI.

Although the mongoc_ssl_opt_t struct itself is shallow-copied by the client, the strings it points to (pem_file, pem_pwd, ca_file, ca_dir, and crl_file) are not copied and must remain valid for the life of the mongoc_client_t.

It is a programming error to call this function on a client from a mongoc_client_pool_t. Instead, call mongoc_client_pool_set_ssl_opts on the pool before popping any clients.



A mongoc_client_t.


A mongoc_ssl_opt_t. The struct is copied by the client, but the strings it points to are not.


This feature requires that the MongoDB C driver was compiled with --enable-ssl.