Trait mongodb::ThreadedClient [] [src]

pub trait ThreadedClient: Sync + Sized {
    fn connect(host: &str, port: u16) -> Result<Self>;
fn connect_with_options(
        host: &str,
        port: u16,
        _: ClientOptions
    ) -> Result<Self>;
fn with_uri(uri: &str) -> Result<Self>;
fn with_uri_and_options(uri: &str, options: ClientOptions) -> Result<Self>;
fn with_config(
        config: ConnectionString,
        options: Option<ClientOptions>,
        description: Option<TopologyDescription>
    ) -> Result<Self>;
fn db(&self, db_name: &str) -> Database;
fn db_with_prefs(
        &self,
        db_name: &str,
        read_preference: Option<ReadPreference>,
        write_concern: Option<WriteConcern>
    ) -> Database;
fn acquire_stream(
        &self,
        read_pref: ReadPreference
    ) -> Result<(PooledStream, bool, bool)>;
fn acquire_write_stream(&self) -> Result<PooledStream>;
fn get_req_id(&self) -> i32;
fn database_names(&self) -> Result<Vec<String>>;
fn drop_database(&self, db_name: &str) -> Result<()>;
fn is_master(&self) -> Result<bool>;
fn add_start_hook(
        &mut self,
        hook: fn(_: Client, _: &CommandStarted)
    ) -> Result<()>;
fn add_completion_hook(
        &mut self,
        hook: fn(_: Client, _: &CommandResult)
    ) -> Result<()>; }

Required Methods

Creates a new Client directly connected to a single MongoDB server.

Creates a new Client directly connected to a single MongoDB server with options.

Creates a new Client connected to a complex topology, such as a replica set or sharded cluster.

Creates a new Client connected to a complex topology, such as a replica set or sharded cluster, with options.

Create a new Client with manual connection configurations. connect and with_uri should generally be used as higher-level constructors.

Creates a database representation.

Creates a database representation with custom read and write controls.

Acquires a connection stream from the pool, along with slave_ok and should_send_read_pref.

Acquires a connection stream from the pool for write operations.

Returns a unique operational request id.

Returns a list of all database names that exist on the server.

Drops the database defined by db_name.

Reports whether this instance is a primary, master, mongos, or standalone mongod instance.

Sets a function to be run every time a command starts.

Sets a function to be run every time a command completes.

Implementors