Struct mongod::ClientBuilder[][src]

pub struct ClientBuilder { /* fields omitted */ }
Expand description

A ClientBuilder can be used to create a Client with custom configuration.

Implementations

Constructs a new ClientBuilder.

This is the same as Client::Builder().

Returns a Client built from this ClientBuilder configuration.

Errors

This method fails if the mongodb::Client cannot be initialised.

Sets the username/password that should be used by this client.

Example

    let _client = mongod::Client::builder()
        .auth("foo", Some("bar"))
        .build().unwrap();

Sets the CA file that should be used by this client for TLS.

Example

    let _client = mongod::Client::builder()
        .ca("./certs/foo.pem")
        .build().unwrap();

Sets the certificate file that should be used by this client for identification.

Example

    let _client = mongod::Client::builder()
        .cert_key("./certs/foo.pem")
        .build().unwrap();

Sets the database that should be used by this client.

Example

    let _client = mongod::Client::builder()
        .database("foo")
        .build().unwrap();

Sets the uri that this client should use to connect to a mongo instance.

Example

    let _client = mongod::Client::builder()
        .uri("mongodb://foo")
        .build()?;

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.