From c4c22e82f4944568b75787a917c5c1c9d728bff9 Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Fri, 18 Aug 2017 13:55:26 +0200 Subject: [PATCH 1/3] Update readme --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7df1af5..5ccbace 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,26 @@ The API should still be considered experimental, but I'm not expecting changes a ## Compatibility -The driver currently only builds on Unix, tested on Mac Os X and Linux so far. It's compatible with MongoDB 2.4 up to 3.4 and -has full replica set and SSL support. +The driver currently only builds on Unix, tested on Mac Os X and Linux so far. It's compatible with MongoDB 2.6 up to 3.4 and has full replica set and SSL support. ## Installation If you have any trouble installing the crate (linking openssl can be tricky) please check out the [installation instructions for the C driver](http://mongoc.org/libmongoc/current/installing.html). +To build on Mac install OpenSSL 1.1: + +``` +brew install openssl@1.1 +``` + +Export these env vars the before you make a clean build: + +``` +export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" +export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" +`` + ## Logging All internal logging by mongoc is redirected to the macros in the [log From 2a42c5da7bde1c04a98e82a0dfb0cb089c0fe6f2 Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Fri, 18 Aug 2017 13:57:06 +0200 Subject: [PATCH 2/3] Add WriteConcernError and DuplicateKey to error --- mongoc-sys/src/lib.rs | 2 ++ src/error.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/mongoc-sys/src/lib.rs b/mongoc-sys/src/lib.rs index f6bdbcb..57cf709 100644 --- a/mongoc-sys/src/lib.rs +++ b/mongoc-sys/src/lib.rs @@ -249,4 +249,6 @@ pub mod bindings { pub const MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND: ::libc::c_uint = 59; pub const MONGOC_ERROR_QUERY_NOT_TAILABLE: ::libc::c_uint = 13051; pub const MONGOC_ERROR_PROTOCOL_ERROR: ::libc::c_uint = 17; + pub const MONGOC_ERROR_WRITE_CONCERN_ERROR: ::libc::c_uint = 64; + pub const MONGOC_ERROR_DUPLICATE_KEY: ::libc::c_uint = 11000; } diff --git a/src/error.rs b/src/error.rs index 7128798..c426735 100644 --- a/src/error.rs +++ b/src/error.rs @@ -146,6 +146,8 @@ pub enum MongoErrorCode { ScramProtocolError, QueryCommandNotFound, QueryNotTailable, + WriteConcernError, + DuplicateKey, Unknown } @@ -222,6 +224,8 @@ impl BsoncError { bindings::MONGOC_ERROR_SCRAM_PROTOCOL_ERROR => MongoErrorCode::ScramProtocolError, bindings::MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND => MongoErrorCode::QueryCommandNotFound, bindings::MONGOC_ERROR_QUERY_NOT_TAILABLE => MongoErrorCode::QueryNotTailable, + bindings::MONGOC_ERROR_WRITE_CONCERN_ERROR => MongoErrorCode::WriteConcernError, + bindings::MONGOC_ERROR_DUPLICATE_KEY => MongoErrorCode::DuplicateKey, _ => MongoErrorCode::Unknown } } From 8445e39a73aa4c9d0a619f01c6b6f610d5556acb Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Fri, 18 Aug 2017 13:57:59 +0200 Subject: [PATCH 3/3] Add error code for unknown error --- src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index c426735..ad41580 100644 --- a/src/error.rs +++ b/src/error.rs @@ -148,7 +148,7 @@ pub enum MongoErrorCode { QueryNotTailable, WriteConcernError, DuplicateKey, - Unknown + Unknown(u32) } impl BsoncError { @@ -226,7 +226,7 @@ impl BsoncError { bindings::MONGOC_ERROR_QUERY_NOT_TAILABLE => MongoErrorCode::QueryNotTailable, bindings::MONGOC_ERROR_WRITE_CONCERN_ERROR => MongoErrorCode::WriteConcernError, bindings::MONGOC_ERROR_DUPLICATE_KEY => MongoErrorCode::DuplicateKey, - _ => MongoErrorCode::Unknown + code => MongoErrorCode::Unknown(code) } }