Type Definition mongodb::Client
[−]
[src]
type Client = Arc<ClientInner>;
Trait Implementations
impl ThreadedClient for Client
[src]
fn connect(host: &str, port: u16) -> Result<Client>
[src]
Creates a new Client directly connected to a single MongoDB server.
fn connect_with_options(
host: &str,
port: u16,
options: ClientOptions
) -> Result<Client>
[src]
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]
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]
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]
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]
Creates a database representation.
fn db_with_prefs(
&self,
db_name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Database
[src]
&self,
db_name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Database
Creates a database representation with custom read and write controls.
fn acquire_stream(
&self,
read_preference: ReadPreference
) -> Result<(PooledStream, bool, bool)>
[src]
&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]
Acquires a connection stream from the pool for write operations.
fn get_req_id(&self) -> i32
[src]
Returns a unique operational request id.
fn database_names(&self) -> Result<Vec<String>>
[src]
Returns a list of all database names that exist on the server.
fn drop_database(&self, db_name: &str) -> Result<()>
[src]
Drops the database defined by db_name
.
fn is_master(&self) -> Result<bool>
[src]
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]
&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]
&mut self,
hook: fn(_: Client, _: &CommandResult)
) -> Result<()>
Sets a function to be run every time a command completes.