Extract 2 variables
This commit is contained in:
parent
14a0aa515c
commit
228a1b256c
1 changed files with 5 additions and 3 deletions
|
|
@ -49,12 +49,14 @@
|
|||
|
||||
(defn ^DBObject find-by-id
|
||||
([^String collection, ^String id]
|
||||
(.findOne (.getCollection monger.core/*mongodb-database* collection) (to-db-object { :_id id })))
|
||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
|
||||
(.findOne coll (to-db-object { :_id id }))))
|
||||
([^String collection, ^String id, ^List fields]
|
||||
(let [n (count fields)
|
||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)
|
||||
n (count fields)
|
||||
ones (replicate 10 1)
|
||||
map-of-fields (zipmap fields ones)]
|
||||
(.findOne (.getCollection monger.core/*mongodb-database* collection) (to-db-object { :_id id }) (to-db-object map-of-fields))))
|
||||
(.findOne coll (to-db-object { :_id id }) (to-db-object map-of-fields))))
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue