Upgrade Java client to 3.2.0

This commit is contained in:
Michael Klishin 2016-01-10 23:42:13 +03:00
parent dd890231ee
commit 45cb68115b
2 changed files with 8 additions and 9 deletions

View file

@ -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))

View file

@ -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"})))