monger.gridfs/find-one-as-map is next to useless, remove it
It does not allow you access file content stream.
This commit is contained in:
parent
a292f082e8
commit
cb9ed8edb5
2 changed files with 3 additions and 10 deletions
|
|
@ -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)))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue