Struct mongo_driver::client::Client
[−]
[src]
pub struct Client<'a> { /* fields omitted */ }
Client that provides access to a MongoDB MongoDB node, replica-set, or sharded-cluster.
It maintains management of underlying sockets and routing to individual nodes based on
ReadPrefs
or WriteConcern
. Clients cannot be shared between threads, pop a new one from
a ClientPool
in every thread that needs a connection instead.
Methods
impl<'a> Client<'a>
[src]
pub fn get_collection<DBT: Into<Vec<u8>>, CT: Into<Vec<u8>>>(
&'a self,
db: DBT,
collection: CT
) -> Collection<'a>
[src]
&'a self,
db: DBT,
collection: CT
) -> Collection<'a>
Borrow a collection
pub fn take_collection<DBT: Into<Vec<u8>>, CT: Into<Vec<u8>>>(
self,
db: DBT,
collection: CT
) -> Collection<'a>
[src]
self,
db: DBT,
collection: CT
) -> Collection<'a>
Take a collection, client is owned by the collection so the collection can easily be passed around
pub fn get_database<S: Into<Vec<u8>>>(&'a self, db: S) -> Database<'a>
[src]
Borrow a database
pub fn take_database<S: Into<Vec<u8>>>(self, db: S) -> Database<'a>
[src]
Take a database, client is owned by the database so the database can easily be passed around
pub fn get_server_status(
&self,
read_prefs: Option<ReadPrefs>
) -> Result<Document>
[src]
&self,
read_prefs: Option<ReadPrefs>
) -> Result<Document>
Queries the server for the current server status, returns a document with this information.