diff --git a/src/clojure/monger/collection.clj b/src/clojure/monger/collection.clj index a4cd230..f9c3c9c 100644 --- a/src/clojure/monger/collection.clj +++ b/src/clojure/monger/collection.clj @@ -147,8 +147,10 @@ (with-open [dbc (find db coll ref)] (map (fn [x] (from-db-object x true)) dbc))) ([^DB db ^String coll ^Map ref fields] + (find-maps db coll ref fields true)) + ([^DB db ^String coll ^Map ref fields keywordize] (with-open [dbc (find db coll ref fields)] - (map (fn [x] (from-db-object x true)) dbc)))) + (map (fn [x] (from-db-object x keywordize)) dbc)))) (defn find-seq "Queries for objects in this collection, returns ISeq of DBObjects." diff --git a/test/monger/test/regular_finders_test.clj b/test/monger/test/regular_finders_test.clj index bf7e6a0..7785f2c 100644 --- a/test/monger/test/regular_finders_test.clj +++ b/test/monger/test/regular_finders_test.clj @@ -281,4 +281,12 @@ (doseq [i clojure-libs] (let [doc (mgcnv/from-db-object i true)] (is (= (:language doc) "Clojure")))) - (is (empty? (mc/find db collection { :language "Erlang" } [:name]))))))) + (is (empty? (mc/find db collection { :language "Erlang" } [:name])))))) + + (deftest find-maps-with-keywordize-false + (let [collection "libraries"] + (mc/insert-batch db collection [{ :language "Clojure", :name "monger" } + { :language "Clojure", :name "langohr" }]) + (let [results (mc/find-maps db collection {:name "langohr"} [] false)] + (is (= 1 (.count results))) + (is (= (get (first results) "language") "Clojure"))))))