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
pub mod forms;
pub mod macros;
pub mod migration;
pub mod models;
pub mod widgets;
#[cfg(test)]
mod tests {
use mongodb::{
options::{ClientOptions, StreamAddress},
Client,
};
#[tokio::test]
async fn test_client() -> Result<(), Box<dyn std::error::Error>> {
let client_options = ClientOptions::builder()
.hosts(vec![StreamAddress {
hostname: "localhost".into(),
port: Some(27017),
}])
.build();
let client: Client = Client::with_options(client_options)?;
for db_name in client.list_database_names(None, None).await? {
println!("{}", db_name);
}
Ok(())
}
}