From cb9ed8edb551e49ded1434e428cd578de1c02bc8 Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Sat, 31 Dec 2011 16:27:56 +0400 Subject: [PATCH] monger.gridfs/find-one-as-map is next to useless, remove it It does not allow you access file content stream. --- src/monger/gridfs.clj | 11 ++--------- test/monger/test/gridfs.clj | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/monger/gridfs.clj b/src/monger/gridfs.clj index bf532de..34a9c6b 100644 --- a/src/monger/gridfs.clj +++ b/src/monger/gridfs.clj @@ -71,27 +71,20 @@ (defprotocol Finders - (find-one [input] "Finds one file using given input (an ObjectId, filename or query)") - (find-one-as-map [input] "Finds one file using given input (an ObjectId, filename or query), converting result to Clojure map before returning")) + (find-one [input] "Finds one file using given input (an ObjectId, filename or query)")) (extend-protocol Finders String (find-one [^String input] (.findOne ^GridFS monger.core/*mongodb-gridfs* input)) - (find-one-as-map [^String input] - (from-db-object (find-one input) true)) org.bson.types.ObjectId (find-one [^org.bson.types.ObjectId input] (.findOne ^GridFS monger.core/*mongodb-gridfs* input)) - (find-one-as-map [^org.bson.types.ObjectId input] - (from-db-object (find-one input) true)) DBObject (find-one [^DBObject input] - (.findOne ^GridFS monger.core/*mongodb-gridfs* input)) - (find-one-as-map [^DBObject input] - (from-db-object (find-one input) true))) + (.findOne ^GridFS monger.core/*mongodb-gridfs* input))) diff --git a/test/monger/test/gridfs.clj b/test/monger/test/gridfs.clj index de08d83..fdb26d0 100644 --- a/test/monger/test/gridfs.clj +++ b/test/monger/test/gridfs.clj @@ -74,7 +74,7 @@ (is (= md5 (:md5 stored))) (is (= filename (:filename stored))) (is (= ct (:contentType stored))) - (are [a b] (is (= a (:md5 (gridfs/find-one-as-map b)))) + (are [a b] (is (= a (:md5 (from-db-object (gridfs/find-one b) true)))) md5 (:_id stored) md5 filename md5 (to-db-object { :md5 md5 }))))