From d966fabd3ec6a1bd8c4bf2d4a1007e70a27cea14 Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Thu, 13 Oct 2011 18:03:53 +0400 Subject: [PATCH] Clean up --- src/monger/conversion.clj | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/monger/conversion.clj b/src/monger/conversion.clj index 5d3b39d..fe7ba16 100644 --- a/src/monger/conversion.clj +++ b/src/monger/conversion.clj @@ -84,24 +84,16 @@ (from-db-object [^DBObject input keywordize] ;; DBObject provides .toMap, but the implementation in ;; subclass GridFSFile unhelpfully throws - ;; UnsupportedOperationException + ;; UnsupportedOperationException. This part is taken from congomongo and + ;; may need revisiting at a later point. MK. (associate-pairs (for [key-set (.keySet input)] [key-set (.get input key-set)]) - keywordize)) - - ;; this idea needs to be tested out first, we will see how well - ;; it works. MK. - ;; DBCursor - ;; (from-db-object [^DBCursor input] - ;; (if (empty? input) - ;; [] - ;; (lazy-seq (seq input)))) - ) + keywordize))) (defn- associate-pairs [pairs keywordize] ;; Taking the keywordize test out of the fn reduces derefs ;; dramatically, which was the main barrier to matching pure-Java - ;; performance for this marshalling + ;; performance for this marshalling. Take from congomongo. MK. (reduce (if keywordize (fn [m [^String k v]] (assoc m (keyword k) (from-db-object v true)))