pub struct Client { /* private fields */ }
Expand description

An asynchronous Client to query mongo with.

The client uses sane defaults but these can be tweaked using the builder. To configure a Client, use Client::builder.

The Client holds a connection pool internally, so it is advised that you create once, and reuse it.

Implementations

Constructs a new Client.

Panics

This method panics if the mongodb::Client fails to initialise.

Use Client::builder() if you wish to handle this failure as an Error instead of panicking.

Creates a ClientInner to configure a Client.

This is the same as ClientBuilder::new().

Constructs a new Client using a mongodb::Client.

Returns the mongodb::Client

Returns the mongodb::Document from the mongodb.

Returns the mongodb::Database from the mongodb.

Convenience method to delete documents from a collection using a given filter.

Errors

This method fails if the mongodb encountered an error.

Convenience method to delete one document from a collection using a given filter.

Errors

This method fails if the mongodb encountered an error.

Convenience method to find documents in a collection.

This function is mainly intended for use cases where the filter is known to return unique hits. If you need something more complicated use find or the FindBuilder.

Errors

This method fails if the mongodb encountered an error.

Convenience method to find a document in a collection using a given filter.

This function is mainly intended for use cases where the filter is known to return unique hits. If you need something more complicated use find or the FindBuilder.

Errors

This method fails if the mongodb encountered an error, or if the found document is invalid.

Convenience method to insert documents in a collection.

Errors

This method fails if the mongodb encountered an error, or if the found document is invalid.

Convenience method to insert a document in a collection.

Errors

This method fails if the mongodb encountered an error, or if the found document is invalid.

Convenience method to replace a document in a collection.

Errors

This method fails if the mongodb encountered an error.

Convenience method to update documents in a collection.

Errors

This method fails if the mongodb encountered an error.

Convenience method to update one document from a collection.

Errors

This method fails if the mongodb encountered an error.

Convenience method to upsert documents from a collection.

Errors

This method fails if the mongodb encountered an error.

Convenience method to upsert one document from a collection.

Errors

This method fails if the mongodb encountered an error.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more