Compare commits

...

15 commits

Author SHA1 Message Date
Michael S. Klishin
9d8d61e7cb Back to snap 2012-11-09 02:19:06 +04:00
Michael S. Klishin
a8bfaa75bd 1.3.4 2012-11-09 02:17:51 +04:00
Michael S. Klishin
9c05ee4ac9 The same fix for data.json compatibility we had in clojurewerkz.support.json 2012-11-09 02:17:45 +04:00
Michael S. Klishin
3657549cc0 Back to snapshot 2012-10-31 02:34:31 +04:00
Michael S. Klishin
676a2e489e 1.3.3 2012-10-31 02:33:26 +04:00
Michael S. Klishin
18656e2c16 Support 0.9.0, for real 2012-10-31 02:32:06 +04:00
Michael S. Klishin
023224426c Back to snapshot 2012-10-31 02:17:40 +04:00
Michael S. Klishin
8940cfe974 1.3.2 2012-10-31 02:17:05 +04:00
Michael S. Klishin
80bef0c077 Change log update 2012-10-31 02:15:19 +04:00
Michael S. Klishin
e2a78f4a89 MongoDB Java driver 2.9.3 2012-10-31 02:15:12 +04:00
Michael S. Klishin
4a493dcdf8 Back to snapshot 2012-10-24 23:44:55 +04:00
Michael S. Klishin
16341dcdcc 1.3.1 2012-10-24 23:44:14 +04:00
Michael S. Klishin
c984f7b62f Support 0.8.0
Fixes clojurewerkz.support.json compilation when clojure.data.json
is not available.

Conflicts:
	ChangeLog.md
2012-10-24 23:42:18 +04:00
Michael S. Klishin
ae95989177 1.3.0 is out 2012-10-24 08:01:09 +04:00
Michael S. Klishin
f8e199159f Back to snapshot 2012-10-24 07:59:06 +04:00
5 changed files with 91 additions and 28 deletions

View file

@ -1,3 +1,41 @@
## Changes between 1.3.4 and 1.3.5
No changes yet.
## Changes between 1.3.3 and 1.3.4
### data.json Dependency Fixes
`monger.json` no longer requires `data.json` to be present at compile time.
## Changes between 1.3.2 and 1.3.3
### ClojureWerkz Support Upgrade
ClojureWerkz Support dependency has been updated to version `0.9.0`.
## Changes between 1.3.1 and 1.3.2
### MongoDB Java Driver Update
MongoDB Java driver dependency has been updated to 2.9.3.
## Changes between 1.3.0 and 1.3.1
### MongoDB Java Driver Update
MongoDB Java driver dependency has been updated to 2.9.2.
### ClojureWerkz Support Upgrade
ClojureWerkz Support dependency has been updated to version `0.8.0`.
## Changes between 1.2.0 and 1.3.0
### monger.core/disconnect!

View file

@ -52,7 +52,7 @@ definition to your `pom.xml`:
With Leiningen:
[com.novemberain/monger "1.2.0"]
[com.novemberain/monger "1.3.4"]
With Maven:
@ -60,7 +60,7 @@ With Maven:
<dependency>
<groupId>com.novemberain</groupId>
<artifactId>monger</artifactId>
<version>1.2.0</version>
<version>1.3.4</version>
</dependency>

View file

@ -1,12 +1,12 @@
(defproject com.novemberain/monger "1.3.0"
(defproject com.novemberain/monger "1.3.5-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.0.0"
:license {:name "Eclipse Public License"}
:dependencies [[org.clojure/clojure "1.4.0"]
[org.mongodb/mongo-java-driver "2.9.2"]
[org.mongodb/mongo-java-driver "2.9.3"]
[com.novemberain/validateur "1.2.0"]
[clojurewerkz/support "0.7.0"]
[clojurewerkz/support "0.9.0"]
[ragtime/ragtime.core "0.3.0"]]
:test-selectors {:default (fn [m]
(and (not (:performance m))
@ -31,11 +31,12 @@
:mailing-list {:name "clojure-mongodb"
:archive "https://groups.google.com/group/clojure-mongodb"
:post "clojure-mongodb@googlegroups.com"}
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]}
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]}
:dj01x {:dependencies [[org.clojure/data.json "0.1.2" :exclusions [org.clojure/clojure]]]}
:dj02x {:dependencies [[org.clojure/data.json "0.2.1" :exclusions [org.clojure/clojure]]]}
:dev {:resource-paths ["test/resources"]
:dependencies [[clj-time "0.4.4" :exclusions [org.clojure/clojure]]
[org.clojure/data.json "0.1.2" :exclusions [org.clojure/clojure]]
[cheshire "4.0.2" :exclusions [org.clojure/clojure]]
[org.clojure/tools.cli "0.2.1" :exclusions [org.clojure/clojure]]
[org.clojure/core.cache "0.6.1" :exclusions [org.clojure/clojure]]
@ -52,7 +53,7 @@
;; only clj-time/JodaTime available, used to test monger.joda-time w/o clojure.data.json
:dev2 {:resource-paths ["test/resources"]
:dependencies [[clj-time "0.4.2" :exclusions [org.clojure/clojure]]]}}
:aliases {"all" ["with-profile" "dev:dev,1.3:dev,1.5"]}
:aliases {"all" ["with-profile" "dev:dev,1.3:dev,1.5:dev,dj01x:dev,dj02x"]}
:repositories {"sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"
:snapshots false
:releases {:checksum :fail :update :always}}

View file

@ -12,24 +12,56 @@
monger.json
(:import org.bson.types.ObjectId))
;;
;; Implementation
;;
;; copied from clojure.reducers
(defmacro ^:private compile-if
"Evaluate `exp` and if it returns logical true and doesn't error, expand to
`then`. Else expand to `else`.
(compile-if (Class/forName \"java.util.concurrent.ForkJoinTask\")
(do-cool-stuff-with-fork-join)
(fall-back-to-executor-services))"
[exp then else]
(if (try (eval exp)
(catch Throwable _ false))
`(do ~then)
`(do ~else)))
;;
;; API
;;
(require 'clojurewerkz.support.json)
(try
(require 'clojure.data.json)
(catch Throwable t
false))
;; all this madness would not be necessary if some people cared about backwards
;; compatiblity of the libraries they maintain. Shame on the clojure.data.json maintainer. MK.
(compile-if (and (find-ns 'clojure.data.json)
clojure.data.json/JSONWriter)
(try
(extend-protocol clojure.data.json/JSONWriter
ObjectId
(-write [^ObjectId object out]
(clojure.data.json/write (.toString object) out)))
(catch Throwable _
false))
(comment "Nothing to do, clojure.data.json is not available"))
(compile-if (and (find-ns 'clojure.data.json)
clojure.data.json/Write-JSON)
(try
(extend-protocol clojure.data.json/Write-JSON
ObjectId
(write-json [^ObjectId object out escape-unicode?]
(clojure.data.json/write-json (.toString object) out escape-unicode?)))
(catch Throwable _
false))
(comment "Nothing to do, clojure.data.json 0.1.x is not available"))
(try
(extend-protocol clojure.data.json/Write-JSON
ObjectId
(write-json [^ObjectId object out escape-unicode?]
(clojure.data.json/write-json (.toString object) out escape-unicode?)))
(catch Throwable _
false))
(try
(require 'cheshire.custom)

View file

@ -6,7 +6,6 @@
com.mongodb.DBObject)
(:require monger.json
monger.joda-time
[clojure.data.json :as json]
[clj-time.core :as t]
[cheshire.custom :as json2]))
@ -14,20 +13,13 @@
(deftest ^{:integration true} serialization-of-joda-datetime-to-json
(let [dt (t/date-time 2011 10 13 23 55 0)]
(is (= "\"2011-10-13T23:55:00.000Z\""
(json/json-str dt)
(json2/encode dt)))))
(deftest ^{:integration true} serialization-of-joda-date-to-json
(let [d (.toDate (t/date-time 2011 10 13 23 55 0))]
(is (= "\"2011-10-13T23:55:00.000Z\""
(json/json-str d)))
(is (= "\"2011-10-13T23:55:00Z\""
(json2/encode d)))))
(deftest ^{:integration true} serialization-of-object-id-to-json-with-clojure-data-json
(is (= "\"4ec2d1a6b55634a935ea4ac8\"" (json/json-str (ObjectId. "4ec2d1a6b55634a935ea4ac8")))))
(deftest ^{:integration true} conversion-of-joda-datetime-to-db-object
(let [d (to-db-object (t/date-time 2011 10 13 23 55 0))]
(is (instance? java.util.Date d))