From cf86245526d923f78ee6b092888860d2fd432aed Mon Sep 17 00:00:00 2001 From: Artem Chistyakov Date: Fri, 18 Sep 2015 15:55:12 -0400 Subject: [PATCH 01/16] =?UTF-8?q?Don=E2=80=99t=20forget=20to=20pass=20cred?= =?UTF-8?q?entials=20to=20MongoClient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It looks like provided credentials are ignored unless `server-address` is a collection. --- src/clojure/monger/core.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clojure/monger/core.clj b/src/clojure/monger/core.clj index be6db26..e900bb5 100644 --- a/src/clojure/monger/core.clj +++ b/src/clojure/monger/core.clj @@ -88,7 +88,7 @@ (if (coll? server-address) (let [server-list ^ArrayList (ArrayList. ^java.util.Collection server-address)] (MongoClient. server-list creds options)) - (MongoClient. ^ServerAddress server-address options)))) + (MongoClient. ^ServerAddress server-address creds options)))) ([{ :keys [host port uri] :or { host *mongodb-host* port *mongodb-port* }}] (if uri (MongoClient. (MongoClientURI. uri)) From 5898cfb3bcd33d5fd4f1dc5c769cd59b813fd026 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:25:17 +0300 Subject: [PATCH 02/16] Back to dev version --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index e938f58..c2cc79c 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.novemberain/monger "3.0.0" +(defproject com.novemberain/monger "3.0.1-SNAPSHOT" :description "Monger is a Clojure MongoDB client for a more civilized age: friendly, flexible and with batteries included" :url "http://clojuremongodb.info" :min-lein-version "2.5.1" From 504a3581620932a868460487574c2f392ae3e15d Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:25:48 +0300 Subject: [PATCH 03/16] MongoDB Java driver 3.0.4 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index c2cc79c..991c204 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.7.0"] - [org.mongodb/mongodb-driver "3.0.2"] + [org.mongodb/mongodb-driver "3.0.4"] [clojurewerkz/support "1.1.0"]] :test-selectors {:default (fn [m] (and (not (:performance m)) From def4ce3e6bf7655bfc4777fe31b4826856998f73 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:26:54 +0300 Subject: [PATCH 04/16] Update change log --- ChangeLog.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index de66d04..988086c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,16 @@ +## Changes between 3.0.0 and 3.0.1 + +### Authencation Function No Longer Ignores Credentials + +In some cases Monger ignored provided credentials. + +Contributed by Artem Chistyakov. + +### MongoDB Java Driver Update + +MongoDB Java driver dependency has been updated to `3.0.4`. + + ## Changes between 2.1.0 and 3.0.0 Monger 3.0 is based on the [MongoDB Java driver 3.0](https://www.mongodb.com/blog/post/introducing-30-java-driver) From bfac6bbe3a58c252f26bb0981265b59c872f6217 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:27:01 +0300 Subject: [PATCH 05/16] 3.0.1 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 991c204..26a00f4 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.novemberain/monger "3.0.1-SNAPSHOT" +(defproject com.novemberain/monger "3.0.1" :description "Monger is a Clojure MongoDB client for a more civilized age: friendly, flexible and with batteries included" :url "http://clojuremongodb.info" :min-lein-version "2.5.1" From 1f395c4e41d38b987209f89aa87d4c7423e7bb60 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:27:38 +0300 Subject: [PATCH 06/16] Back to dev version --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 26a00f4..4cbe8f8 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.novemberain/monger "3.0.1" +(defproject com.novemberain/monger "3.0.2-SNAPSHOT" :description "Monger is a Clojure MongoDB client for a more civilized age: friendly, flexible and with batteries included" :url "http://clojuremongodb.info" :min-lein-version "2.5.1" From 45599a4f5135abfa0e10afa84246caa0d03f7f76 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:31:11 +0300 Subject: [PATCH 07/16] Print MongoDB version on Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 47e47d8..291bd8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: clojure lein: lein2 before_script: + - mongod --version - ./bin/ci/before_script.sh script: lein2 do clean, javac, test jdk: From 8cefa7fc9eb51300cb9e37fb0490dcd79c5b36ff Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:31:23 +0300 Subject: [PATCH 08/16] Test 3.0.x, 2.1.x is no longer maintained --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 291bd8e..ede0043 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ services: branches: only: - master - - 2.1.x-stable + - 3.0.x-stable From 9178df179dace67a05419700c379f774b3b73cc9 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:44:24 +0300 Subject: [PATCH 09/16] MongoDB installation script --- bin/ci/install_mongodb.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bin/ci/install_mongodb.sh diff --git a/bin/ci/install_mongodb.sh b/bin/ci/install_mongodb.sh new file mode 100644 index 0000000..74c671b --- /dev/null +++ b/bin/ci/install_mongodb.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 +echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org.list + +sudo apt-get update +sudo apt-get install -y mongodb-org From b59ccb4087da24749ff213a70a73c280c989d9c2 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:44:48 +0300 Subject: [PATCH 10/16] Make this script executable --- bin/ci/install_mongodb.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/ci/install_mongodb.sh diff --git a/bin/ci/install_mongodb.sh b/bin/ci/install_mongodb.sh old mode 100644 new mode 100755 From 7195f77945241b01e3c1b5ac566cfa6660ba83cf Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 25 Sep 2015 01:45:38 +0300 Subject: [PATCH 11/16] Install MongoDB 3.0 before running tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ede0043..58485c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: clojure lein: lein2 before_script: + - ./bin/ci/install_mongodb.sh - mongod --version - ./bin/ci/before_script.sh script: lein2 do clean, javac, test From dd890231ee5cdc067bf4cdb10e320bde203691fe Mon Sep 17 00:00:00 2001 From: Stijn Opheide Date: Wed, 6 Jan 2016 12:00:08 +0100 Subject: [PATCH 12/16] Fix cursor hinting The .hint method should be applied on the cursor object instead of the DBObject contained in the hint field. --- src/clojure/monger/query.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clojure/monger/query.clj b/src/clojure/monger/query.clj index a86c21e..2d93313 100644 --- a/src/clojure/monger/query.clj +++ b/src/clojure/monger/query.clj @@ -106,7 +106,7 @@ (when snapshot (.snapshot cursor)) (when hint - (.hint (to-db-object hint))) + (.hint cursor (to-db-object hint))) (when read-preference (.setReadPreference cursor read-preference)) (when options From 45cb68115bbe425fa578d74f9f9312e158738d94 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 10 Jan 2016 23:42:13 +0300 Subject: [PATCH 13/16] Upgrade Java client to 3.2.0 --- project.clj | 2 +- test/monger/test/indexing_test.clj | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/project.clj b/project.clj index 4cbe8f8..ffe9586 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.7.0"] - [org.mongodb/mongodb-driver "3.0.4"] + [org.mongodb/mongodb-driver "3.2.0"] [clojurewerkz/support "1.1.0"]] :test-selectors {:default (fn [m] (and (not (:performance m)) diff --git a/test/monger/test/indexing_test.clj b/test/monger/test/indexing_test.clj index 7211182..c74a570 100644 --- a/test/monger/test/indexing_test.clj +++ b/test/monger/test/indexing_test.clj @@ -13,14 +13,12 @@ (let [collection "libraries"] (mc/drop-indexes db collection) (mc/create-index db collection {"language" 1}) - (is (= "language_" + (is (= "language_1" (:name (second (mc/indexes-on db collection))))) (mc/drop-indexes db collection) - (mc/create-index db collection ["language"]) - (mc/drop-index db collection {"language" 1}) (is (nil? (second (mc/indexes-on db collection)))) (mc/ensure-index db collection (array-map "language" 1) {:unique true}) - (is (= "language_" + (is (= "language_1" (:name (second (mc/indexes-on db collection))))) (mc/drop-indexes db collection) (mc/ensure-index db collection (array-map "language" 1)) @@ -32,17 +30,18 @@ (deftest ^{:indexing true :time-consuming true} test-ttl-collections (let [coll "recent_events" - ttl 30 - sleep 120] + ttl 15 + sleep 65] (mc/remove db coll) + (mc/drop-indexes db coll) (mc/ensure-index db coll (array-map :created-at 1) {:expireAfterSeconds ttl}) (dotimes [i 100] (mc/insert db coll {:type "signup" :created-at (-> i seconds ago) :i i})) (dotimes [i 100] (mc/insert db coll {:type "signup" :created-at (-> i seconds from-now) :i i})) (is (= 200 (mc/count db coll {:type "signup"}))) - ;; sleep for 65 seconds. MongoDB 2.1.2 seems to run TTLMonitor once per minute, according to - ;; the log. MK. + ;; sleep for > 60 seconds. MongoDB seems to run TTLMonitor once per minute, according to + ;; the log. (println (format "Now sleeping for %d seconds to test TTL collections!" sleep)) (Thread/sleep (* sleep 1000)) (println (format "Documents in the TTL collection: %d" (mc/count db coll {:type "signup"}))) From fdb354b2db0e0c74acc151b76ea431b6f9e6309d Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 10 Jan 2016 23:42:57 +0300 Subject: [PATCH 14/16] Update change log --- ChangeLog.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 988086c..64ca17d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,14 @@ +## Changes between 3.0.1 and 3.0.2 + +### MongoDB Java Driver Update + +MongoDB Java driver dependency has been updated to `3.2.0`. + +### Cursor Hinting Option Fix + +Contributed by Stijn Opheide. + + ## Changes between 3.0.0 and 3.0.1 ### Authencation Function No Longer Ignores Credentials From 6c25763748fa937f0c778b61dd7078545326ad2b Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 10 Jan 2016 23:43:07 +0300 Subject: [PATCH 15/16] 3.0.2 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index ffe9586..c48fcd1 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.novemberain/monger "3.0.2-SNAPSHOT" +(defproject com.novemberain/monger "3.0.2" :description "Monger is a Clojure MongoDB client for a more civilized age: friendly, flexible and with batteries included" :url "http://clojuremongodb.info" :min-lein-version "2.5.1" From 114630f769f96fb3bd39e09d5ee8d4701f6a2b18 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 10 Jan 2016 23:43:49 +0300 Subject: [PATCH 16/16] Back to dev version --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index c48fcd1..4855ec6 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.novemberain/monger "3.0.2" +(defproject com.novemberain/monger "3.0.3-SNAPSHOT" :description "Monger is a Clojure MongoDB client for a more civilized age: friendly, flexible and with batteries included" :url "http://clojuremongodb.info" :min-lein-version "2.5.1"