diff --git a/.travis.yml b/.travis.yml index d21ac245..4aec2e9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,23 @@ language: rust before_install: - - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.7.tgz - - tar xvf mongodb-linux-x86_64-3.0.7.tgz - - mv mongodb-linux-x86_64-3.0.7 3.0.7 - - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.0.tgz - - tar xvf mongodb-linux-x86_64-3.2.0.tgz - - mv mongodb-linux-x86_64-3.2.0 3.2.0 + - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.10.tgz + - tar xvf mongodb-linux-x86_64-3.0.10.tgz + - mv mongodb-linux-x86_64-3.0.10 3.0.10 + - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.4.tgz + - tar xvf mongodb-linux-x86_64-3.2.4.tgz + - mv mongodb-linux-x86_64-3.2.4 3.2.4 env: - RUST_TEST_THREADS=1 script: - mkdir -p ./data/db ./data/test ./data/db2 ./data/test2 - - 3.0.7/bin/mongod --fork --nopreallocj --dbpath ./data/db --syslog --port 27017 - - 3.0.7/bin/mongod --fork --nopreallocj --dbpath ./data/test --syslog --port 27018 + - 3.0.10/bin/mongod --fork --nopreallocj --dbpath ./data/db --syslog --port 27017 + - 3.0.10/bin/mongod --fork --nopreallocj --dbpath ./data/test --syslog --port 27018 - cargo build --verbose - cargo test v3_0 --verbose - killall mongod - - 3.2.0/bin/mongod --fork --nopreallocj --dbpath ./data/db2 --syslog --port 27017 - - 3.2.0/bin/mongod --fork --nopreallocj --dbpath ./data/test2 --syslog --port 27018 + - 3.2.4/bin/mongod --fork --nopreallocj --dbpath ./data/db2 --syslog --port 27017 + - 3.2.4/bin/mongod --fork --nopreallocj --dbpath ./data/test2 --syslog --port 27018 - cargo test v3_2 --verbose diff --git a/Cargo.lock b/Cargo.lock index 25aef63a..fd429c59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,42 +1,49 @@ [root] name = "mongodb" -version = "0.1.1" +version = "0.1.3" dependencies = [ - "bson 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bson 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "bufstream 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", - "nalgebra 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nalgebra 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "scan_fmt 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "separator 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textnonce 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "separator 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "textnonce 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "advapi32-sys" -version = "0.1.2" +name = "aster" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bitflags" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bson" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -49,30 +56,31 @@ name = "byteorder" version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byteorder" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "chrono" -version = "0.2.16" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gcc" -version = "0.3.19" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "kernel32-sys" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -81,33 +89,67 @@ name = "libc" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libc" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "linked-hash-map" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nalgebra" -version = "0.2.23" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num" -version = "0.1.27" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quasi" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quasi_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aster 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.3.11" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -115,16 +157,16 @@ name = "rust-crypto" version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -134,32 +176,87 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "separator" -version = "0.3.0" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_codegen" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aster 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quasi 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quasi_codegen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_syntax" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "textnonce" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicode-xid" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] diff --git a/Cargo.toml b/Cargo.toml index 82acd831..463790f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,17 +13,17 @@ keywords = ["mongo", "mongodb", "database", "bson", "nosql"] license = "Apache-2.0" [dependencies] -bson = "0.1.4" -byteorder = "0.3" +bson = "0.2" +byteorder = "0.5" chrono = "0.2" rand = "0.3" rust-crypto = "0.2.31" rustc-serialize = "0.3" scan_fmt = "0.1.0" -separator = "0.3.0" -textnonce = "0.1.1" +separator = "0.3.1" +textnonce = "0.3" time = "0.1" bufstream = "0.1.1" [dev-dependencies] -nalgebra = "0.2" +nalgebra = "0.5" diff --git a/src/error.rs b/src/error.rs index 3637e740..382eef3a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,5 @@ //! MongoDB Errors and Error Codes. use bson::{self, oid}; -use byteorder; use coll::error::{WriteException, BulkWriteException}; use rustc_serialize::hex; use std::{error, fmt, io, result, sync}; @@ -127,12 +126,6 @@ impl From for Error { } } -impl From for Error { - fn from(err: byteorder::Error) -> Error { - Error::IoError(From::from(err)) - } -} - impl From> for Error { fn from(_: sync::PoisonError) -> Error { Error::PoisonLockError diff --git a/tests/json/eq.rs b/tests/json/eq.rs index f388f9a1..73596e41 100644 --- a/tests/json/eq.rs +++ b/tests/json/eq.rs @@ -27,28 +27,6 @@ impl NumEq for Bson { } pub fn bson_eq(b1: &Bson, b2: &Bson) -> bool { - macro_rules! doc_eq { - ( $x:expr, $y:expr ) => { - { - if $x.keys != $y.keys { - return false; - } - - for key in $x.keys { - match ($x.get(&key), $y.get(&key)) { - (Some(v1), Some(v2)) => if !bson_eq(v1, v2) { - return false; - }, - (None, None) => (), - _ => return false - } - } - - true - } - }; - } - match b1 { &Bson::FloatingPoint(f) => b2.float_eq(f), &Bson::I32(i) => b2.int_eq(i as i64), @@ -66,8 +44,7 @@ pub fn bson_eq(b1: &Bson, b2: &Bson) -> bool { true }), &Bson::Document(ref doc) => - var_match!(b2, &Bson::Document(ref other_doc) => - doc_eq!(doc.clone(), other_doc.clone())), + var_match!(b2, &Bson::Document(ref other_doc) => doc == other_doc), &Bson::Boolean(b) => var_match!(b2, &Bson::Boolean(bb) => b == bb), &Bson::Null => var_match!(b2, &Bson::Null => true), &Bson::RegExp(ref s1, ref s2) => @@ -77,7 +54,7 @@ pub fn bson_eq(b1: &Bson, b2: &Bson) -> bool { var_match!(b2, &Bson::JavaScriptCode(ref ss) => s == ss), &Bson::JavaScriptCodeWithScope(ref s, ref doc) => var_match!(b2, &Bson::JavaScriptCodeWithScope(ref ss, ref other_doc) => - s == ss && doc_eq!(doc.clone(), other_doc.clone())), + s == ss && doc == other_doc), &Bson::TimeStamp(i) => var_match!(b2, &Bson::TimeStamp(ii) => i == ii), &Bson::Binary(sub_ty, ref bits) => var_match!(b2, &Bson::Binary(other_sub_ty, ref other_bits) =>