Struct mongod::Client [−][src]
pub struct Client { /* fields omitted */ }
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::Document
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.
pub async fn delete_one<C, F>(&self, filter: F) -> Result<bool, Error> where
C: AsFilter<F> + Collection,
F: Filter,
pub async fn delete_one<C, F>(&self, filter: F) -> Result<bool, Error> where
C: AsFilter<F> + Collection,
F: Filter,
Convenience method to delete one document from a collection using a given filter.
Errors
This method fails if the mongodb encountered an error.
pub async fn find<C, F>(
&self,
filter: Option<F>
) -> Result<TypedCursor<C>, Error> where
C: AsFilter<F> + Collection,
F: Filter,
pub async fn find<C, F>(
&self,
filter: Option<F>
) -> Result<TypedCursor<C>, Error> where
C: AsFilter<F> + Collection,
F: Filter,
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.
pub async fn replace_one<C, F>(
&self,
filter: F,
document: C
) -> Result<bool, Error> where
C: AsFilter<F> + Collection,
F: Filter,
pub async fn replace_one<C, F>(
&self,
filter: F,
document: C
) -> Result<bool, Error> where
C: AsFilter<F> + Collection,
F: Filter,
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.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self