Skip to content

Commit

Permalink
Drop Clojure 1.3.0 support for CongoMongo 0.5.0
Browse files Browse the repository at this point in the history
Switch :use/:only over to :require/:refer; drop 1.3 from test matrix;
use reduce-kv instead of plain reduce where possible (only one place?).
  • Loading branch information
seancorfield committed Jun 10, 2016
1 parent c67be32 commit a847718
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
7 changes: 3 additions & 4 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(defproject congomongo
"0.4.8"
"0.5.0"
:description "Clojure-friendly API for MongoDB"
:url "https://github.com/aboekhoff/congomongo"
:mailing-list {:name "CongoMongo mailing list"
Expand All @@ -14,11 +14,10 @@
[org.clojure/clojure "1.8.0" :scope "provided"]]
;; if a :dev profile is added, remember to update :aliases below to
;; use it in each with-profile group!
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
:profiles {:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
:1.9 {:repositories [["snapshots" "https://oss.sonatype.org/content/repositories/snapshots/"]]
:dependencies [[org.clojure/clojure "1.9.0-master-SNAPSHOT"]]}}
:aliases {"test-all" ["with-profile" "default:1.3,default:1.4,default:1.5,default:1.6,default:1.7,default,default:1.9" "test"]})
:aliases {"test-all" ["with-profile" "default:1.4,default:1.5,default:1.6,default:1.7,default,default:1.9" "test"]})
17 changes: 13 additions & 4 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ What?
------
A toolkit for using MongoDB with Clojure.

For Clojure 1.2.1 and earlier, use CongoMongo 0.2.3 or earlier. CongoMongo 0.2.3 is the last release that will support Clojure 1.2.x. CongoMongo 0.3.0 onward no longer supports Clojure 1.2.x.
CongoMongo 0.5.0 onward no longer supports Clojure 1.3.0 or earlier.
For Clojure 1.3.0, use CongoMongo 0.3.0 thru 0.4.8. CongoMongo 0.4.8 is the last release that supports Clojure 1.3.0.
For Clojure 1.2.1 and earlier, use CongoMongo 0.2.3 or earlier. CongoMongo 0.2.3 is the last release that supports Clojure 1.2.x.

News
--------------
Version 0.5.0 - Jun 6th, 2016

* DROP SUPPORT FOR CLOJURE 1.3.0!
* Add Clojure 1.9.0 compatibility (handling of seqable? in coerce namespace) - issue #147
* Clojure is now a "provided" dependency and should no longer appear as a transitive dependency in projects that use CongoMongo, making it easier to get rid of conflicts! _Potentially a breaking change if a project depended on CongoMongo but did not have an explicit dependency on Clojure itself._

Version 0.4.8 - Feb 25th, 2016

* Update clojure.data.json to 0.2.6
Expand Down Expand Up @@ -398,13 +406,14 @@ Install
-------

Leiningen is the recommended way to use congomongo.
If you are using Clojure 1.3.0 or later, just add
If you are using Clojure 1.4.0 or later, just add

[congomongo "0.4.8"]
[congomongo "0.5.0"]

to your project.clj (for the latest stable version).

If you are still on Clojure 1.2.x, use congomongo version 0.2.3 instead.
If you are still on Clojure 1.3.0, use CongoMongo 0.3.0-0.4.8.
If you are still on Clojure 1.2.x, use CongoMongo version 0.2.3 instead.

### Feedback

Expand Down
8 changes: 4 additions & 4 deletions src/somnium/congomongo.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
^{:author "Andrew Boekhoff, Sean Corfield",
:doc "Various wrappers and utilities for the mongodb-java-driver"}
somnium.congomongo
(:require [clojure.string])
(:use [clojure.walk :only (postwalk)]
[somnium.congomongo.config :only [*mongo-config*]]
[somnium.congomongo.coerce :only [coerce coerce-fields coerce-index-fields]])
(:require [clojure.string]
[clojure.walk :refer (postwalk)]
[somnium.congomongo.config :refer [*mongo-config*]]
[somnium.congomongo.coerce :refer [coerce coerce-fields coerce-index-fields]])
(:import [com.mongodb MongoClient MongoClientOptions MongoClientOptions$Builder MongoClientURI
DB DBCollection DBObject DBRef ServerAddress ReadPreference WriteConcern Bytes DBCursor]
[com.mongodb.gridfs GridFS]
Expand Down
8 changes: 4 additions & 4 deletions src/somnium/congomongo/coerce.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns somnium.congomongo.coerce
;; Clojure 1.3 support prevents us using :require :refer here
(:use [clojure.data.json :only [write-str read-str]])
(:require [clojure.data.json :refer [write-str read-str]])
(:import [clojure.lang IPersistentMap IPersistentVector Keyword]
[java.util Map List Set]
[com.mongodb DBObject BasicDBObject BasicDBList]
Expand Down Expand Up @@ -142,8 +141,9 @@
maps truthy to 1 and falsey to 0, default 1."
[fields]
(clojure->mongo ^IPersistentMap (if (map? fields)
(into {} (for [[k v] fields]
[k (if v 1 0)]))
(reduce-kv (fn [m k v]
(assoc m k (if v 1 0)))
{} fields)
(zipmap fields (repeat 1)))))

(defn ^DBObject coerce-ordered-fields
Expand Down
4 changes: 2 additions & 2 deletions src/somnium/congomongo/error.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns
^{:author "Jeff Sapp"}
somnium.congomongo.error
(:use [somnium.congomongo.config :only [*mongo-config*]])
(:require [somnium.congomongo.config :refer [*mongo-config*]])
(:import [com.mongodb DB]))

(defn get-last-error
Expand All @@ -24,4 +24,4 @@
(defn force-error!
"This method forces an error"
[]
(into {} (.forceError ^DB (:db *mongo-config*))))
(into {} (.forceError ^DB (:db *mongo-config*))))

0 comments on commit a847718

Please sign in to comment.