Trait mongodb::db::ThreadedDatabase
[−]
[src]
pub trait ThreadedDatabase { fn open(
client: Client,
name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Database; fn version(&self) -> Result<Version>; fn auth(&self, user: &str, password: &str) -> Result<()>; fn collection(&self, coll_name: &str) -> Collection; fn collection_with_prefs(
&self,
coll_name: &str,
create: bool,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Collection; fn get_req_id(&self) -> i32; fn command_cursor(
&self,
spec: Document,
cmd_type: CommandType,
read_pref: ReadPreference
) -> Result<Cursor>; fn command(
&self,
spec: Document,
cmd_type: CommandType,
read_preference: Option<ReadPreference>
) -> Result<Document>; fn list_collections(&self, filter: Option<Document>) -> Result<Cursor>; fn list_collections_with_batch_size(
&self,
filter: Option<Document>,
batch_size: i32
) -> Result<Cursor>; fn collection_names(&self, filter: Option<Document>) -> Result<Vec<String>>; fn create_collection(
&self,
name: &str,
options: Option<CreateCollectionOptions>
) -> Result<()>; fn create_user(
&self,
name: &str,
password: &str,
options: Option<CreateUserOptions>
) -> Result<()>; fn drop_all_users(&self, write_concern: Option<WriteConcern>) -> Result<i32>; fn drop_collection(&self, name: &str) -> Result<()>; fn drop_database(&self) -> Result<()>; fn drop_user(&self, name: &str, _: Option<WriteConcern>) -> Result<()>; fn get_all_users(&self, show_credentials: bool) -> Result<Vec<Document>>; fn get_user(
&self,
user: &str,
options: Option<UserInfoOptions>
) -> Result<Document>; fn get_users(
&self,
users: Vec<&str>,
options: Option<UserInfoOptions>
) -> Result<Vec<Document>>; }
Required Methods
fn open(
client: Client,
name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Database
client: Client,
name: &str,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Database
Creates a database representation with optional read and write controls.
fn version(&self) -> Result<Version>
fn auth(&self, user: &str, password: &str) -> Result<()>
Logs in a user using the SCRAM-SHA-1 mechanism.
fn collection(&self, coll_name: &str) -> Collection
Creates a collection representation with inherited read and write controls.
fn collection_with_prefs(
&self,
coll_name: &str,
create: bool,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Collection
&self,
coll_name: &str,
create: bool,
read_preference: Option<ReadPreference>,
write_concern: Option<WriteConcern>
) -> Collection
Creates a collection representation with custom read and write controls.
fn get_req_id(&self) -> i32
Return a unique operational request id.
fn command_cursor(
&self,
spec: Document,
cmd_type: CommandType,
read_pref: ReadPreference
) -> Result<Cursor>
&self,
spec: Document,
cmd_type: CommandType,
read_pref: ReadPreference
) -> Result<Cursor>
Generates a cursor for a relevant operational command.
fn command(
&self,
spec: Document,
cmd_type: CommandType,
read_preference: Option<ReadPreference>
) -> Result<Document>
&self,
spec: Document,
cmd_type: CommandType,
read_preference: Option<ReadPreference>
) -> Result<Document>
Sends an administrative command over find_one.
fn list_collections(&self, filter: Option<Document>) -> Result<Cursor>
Returns a list of collections within the database.
fn list_collections_with_batch_size(
&self,
filter: Option<Document>,
batch_size: i32
) -> Result<Cursor>
&self,
filter: Option<Document>,
batch_size: i32
) -> Result<Cursor>
Returns a list of collections within the database with a custom batch size.
fn collection_names(&self, filter: Option<Document>) -> Result<Vec<String>>
Returns a list of collection names within the database.
fn create_collection(
&self,
name: &str,
options: Option<CreateCollectionOptions>
) -> Result<()>
&self,
name: &str,
options: Option<CreateCollectionOptions>
) -> Result<()>
Creates a new collection.
Note that due to the implicit creation of collections during insertion, this method should only be used to instantiate capped collections.
fn create_user(
&self,
name: &str,
password: &str,
options: Option<CreateUserOptions>
) -> Result<()>
&self,
name: &str,
password: &str,
options: Option<CreateUserOptions>
) -> Result<()>
Creates a new user.
fn drop_all_users(&self, write_concern: Option<WriteConcern>) -> Result<i32>
Permanently deletes all users from the database.
fn drop_collection(&self, name: &str) -> Result<()>
Permanently deletes the collection from the database.
fn drop_database(&self) -> Result<()>
Permanently deletes the database from the server.
fn drop_user(&self, name: &str, _: Option<WriteConcern>) -> Result<()>
Permanently deletes the user from the database.
fn get_all_users(&self, show_credentials: bool) -> Result<Vec<Document>>
Retrieves information about all users in the database.
fn get_user(
&self,
user: &str,
options: Option<UserInfoOptions>
) -> Result<Document>
&self,
user: &str,
options: Option<UserInfoOptions>
) -> Result<Document>
Retrieves information about a given user from the database.
fn get_users(
&self,
users: Vec<&str>,
options: Option<UserInfoOptions>
) -> Result<Vec<Document>>
&self,
users: Vec<&str>,
options: Option<UserInfoOptions>
) -> Result<Vec<Document>>
Retrieves information about a given set of users from the database.
Implementors
impl ThreadedDatabase for Database