Skip to content

Commit fcf023f

Browse files
committed
#update for qifi module
1 parent 4bd0620 commit fcf023f

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Cargo.toml

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ edition = "2018"
66
description = "A fast Api and Structure load"
77

88
[dependencies]
9-
bson = "0.13.0"
10-
serde_json = "*"
11-
serde_derive = "1.0"
12-
serde = { version = "1.0", features = ["derive"] } # 序列化
13-
mongodb = "0.3.12"
9+
bson = "1.1.0"
10+
serde_json = "1.0.60"
11+
serde_derive = "1.0.118"
12+
serde = { version = "1.0.118", features = ["derive"] } # 序列化
13+
1414
serde_bytes = "0.10"
1515

1616
[profile.release]
1717
lto = "fat"
1818

19-
19+
[dependencies.mongodb]
20+
version = "1.1.0"
21+
default-features = false
22+
features = ["sync"]
2023
[[example]]
2124
name = "mongodbtest"
2225

examples/mongodbtest.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bson::Bson;
2-
use mongodb::Client;
2+
use mongodb::sync::Client;
33
use bson::Document;
44

55
use qifi_rs::{from_string, QIFI, from_serde_value, to_doc};
@@ -10,7 +10,7 @@ extern crate serde;
1010
extern crate serde_json;
1111

1212
fn main() {
13-
let client = Client::with_uri_str("mongodb://192.168.2.118:27017").expect("Failed to initialize standalone client.");
13+
let client = Client::with_uri_str("mongodb://192.168.2.117:27017").unwrap();//("Failed to initialize standalone client.");
1414
let coll = client.database("QAREALTIME").collection("account");
1515
let cursor = coll.find(None, None).ok().expect("Failed to execute find.");
1616
// 将读取出来的数据载入为json字符串
@@ -24,5 +24,7 @@ fn main() {
2424
let c: QIFI = from_serde_value(x).unwrap();
2525
// 转换为document
2626
let v = to_doc(c);
27-
coll.insert_one(v, None);
27+
println!("{:#?}", v);
28+
29+
//coll.insert_one(v, None);
2830
}

0 commit comments

Comments
 (0)