1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Options for database-level commands.
use bson::Document;
use common::WriteConcern;
use db::roles::Role;

#[derive(Default)]
pub struct CreateCollectionOptions {
    pub capped: bool,
    pub auto_index_id: bool,
    pub size: Option<i64>,
    pub max: Option<i64>,
    pub use_power_of_two_sizes: bool,
    pub no_padding: bool,
}

impl CreateCollectionOptions {
    pub fn new() -> CreateCollectionOptions {
        CreateCollectionOptions {
            capped: false,
            auto_index_id: true,
            size: None,
            max: None,
            use_power_of_two_sizes: true,
            no_padding: false,
        }
    }
}

#[derive(Default)]
pub struct CreateUserOptions {
    pub custom_data: Option<Document>,
    pub roles: Vec<Role>,
    pub write_concern: Option<WriteConcern>,
}

impl CreateUserOptions {
    pub fn new() -> CreateUserOptions {
        CreateUserOptions {
            custom_data: None,
            roles: vec![],
            write_concern: None,
        }
    }
}

#[derive(Default)]
pub struct UserInfoOptions {
    pub show_credentials: bool,
    pub show_privileges: bool,
}

impl UserInfoOptions {
    pub fn new() -> UserInfoOptions {
        UserInfoOptions {
            show_credentials: false,
            show_privileges: false,
        }
    }
}