Type Definition mongodb::Client [−][src]
type Client = Arc<ClientInner>;
Trait Implementations
impl ThreadedClient for Client[src]
impl ThreadedClient for Clientfn connect(host: &str, port: u16) -> Result<Client>[src]
fn connect(host: &str, port: u16) -> Result<Client>Creates a new Client directly connected to a single MongoDB server.
fn connect_with_options(
host: &str,
port: u16,
options: ClientOptions
) -> Result<Client>[src]
fn connect_with_options(
host: &str,
port: u16,
options: ClientOptions
) -> Result<Client>Creates a new Client directly connected to a single MongoDB server with options.
fn with_uri(uri: &str) -> Result<Client>[src]
fn with_uri(uri: &str) -> Result<Client>Creates a new Client connected to a complex topology, such as a replica set or sharded cluster. Read more
fn with_uri_and_options(uri: &str, options: ClientOptions) -> Result<Client>[src]
fn with_uri_and_options(uri: &str, options: ClientOptions) -> Result<Client>Creates a new Client connected to a complex topology, such as a replica set or sharded cluster, with options. Read more
fn with_config(
config: ConnectionString,
options: Option<ClientOptions>,
description: Option<TopologyDescription>
) -> Result<Client>[src]
fn with_config(
config: ConnectionString,
options: Option<ClientOptions>,
description: Option<TopologyDescription>
) -> Result<Client>Create a new Client with manual connection configurations. connect and with_uri should generally be used as higher-level constructors. Read more
fn db(&self, db_name: &str) -> Database[src]
fn db(&self, db_name: &str) -> DatabaseCreates a database representation.
fn db_with_prefs(
&self,
db_name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Database[src]
fn db_with_prefs(
&self,
db_name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> DatabaseCreates a database representation with custom read and write controls.
fn acquire_stream(
&self,
read_preference: ReadPreference
) -> Result<(PooledStream, bool, bool)>[src]
fn acquire_stream(
&self,
read_preference: ReadPreference
) -> Result<(PooledStream, bool, bool)>Acquires a connection stream from the pool, along with slave_ok and should_send_read_pref.
fn acquire_write_stream(&self) -> Result<PooledStream>[src]
fn acquire_write_stream(&self) -> Result<PooledStream>Acquires a connection stream from the pool for write operations.
fn get_req_id(&self) -> i32[src]
fn get_req_id(&self) -> i32Returns a unique operational request id.
fn database_names(&self) -> Result<Vec<String>>[src]
fn database_names(&self) -> Result<Vec<String>>Returns a list of all database names that exist on the server.
fn drop_database(&self, db_name: &str) -> Result<()>[src]
fn drop_database(&self, db_name: &str) -> Result<()>Drops the database defined by db_name.
fn is_master(&self) -> Result<bool>[src]
fn is_master(&self) -> Result<bool>Reports whether this instance is a primary, master, mongos, or standalone mongod instance.
fn add_start_hook(
&mut self,
hook: fn(_: Client, _: &CommandStarted)
) -> Result<()>[src]
fn add_start_hook(
&mut self,
hook: fn(_: Client, _: &CommandStarted)
) -> Result<()>Sets a function to be run every time a command starts.
fn add_completion_hook(
&mut self,
hook: fn(_: Client, _: &CommandResult)
) -> Result<()>[src]
fn add_completion_hook(
&mut self,
hook: fn(_: Client, _: &CommandResult)
) -> Result<()>Sets a function to be run every time a command completes.