Remove type hints that can be inferred by the compiler, part 2
This commit is contained in:
parent
423b80774a
commit
e008e0d18d
1 changed files with 40 additions and 40 deletions
|
|
@ -157,15 +157,15 @@
|
||||||
|
|
||||||
"
|
"
|
||||||
([^String collection ^Map ref]
|
([^String collection ^Map ref]
|
||||||
(.findOne ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.findOne (.getCollection monger.core/*mongodb-database* collection)
|
||||||
^DBObject (to-db-object ref)))
|
(to-db-object ref)))
|
||||||
([^String collection ^Map ref fields]
|
([^String collection ^Map ref fields]
|
||||||
(.findOne ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.findOne (.getCollection monger.core/*mongodb-database* collection)
|
||||||
^DBObject (to-db-object ref)
|
(to-db-object ref)
|
||||||
^DBObject (as-field-selector fields)))
|
^DBObject (as-field-selector fields)))
|
||||||
([^DB db ^String collection ^Map ref fields]
|
([^DB db ^String collection ^Map ref fields]
|
||||||
(.findOne ^DBCollection (.getCollection db collection)
|
(.findOne (.getCollection db collection)
|
||||||
^DBObject (to-db-object ref)
|
(to-db-object ref)
|
||||||
^DBObject (as-field-selector fields))))
|
^DBObject (as-field-selector fields))))
|
||||||
|
|
||||||
(defn ^IPersistentMap find-one-as-map
|
(defn ^IPersistentMap find-one-as-map
|
||||||
|
|
@ -208,12 +208,12 @@
|
||||||
"
|
"
|
||||||
([^String collection ^Map conditions ^Map document & { :keys [fields sort remove return-new upsert keywordize] :or
|
([^String collection ^Map conditions ^Map document & { :keys [fields sort remove return-new upsert keywordize] :or
|
||||||
{ fields nil sort nil remove false return-new false upsert false keywordize true }}]
|
{ fields nil sort nil remove false return-new false upsert false keywordize true }}]
|
||||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)
|
(let [coll (.getCollection monger.core/*mongodb-database* collection)
|
||||||
maybe-fields (when fields (as-field-selector fields))
|
maybe-fields (when fields (as-field-selector fields))
|
||||||
maybe-sort (when sort (to-db-object sort))]
|
maybe-sort (when sort (to-db-object sort))]
|
||||||
(from-db-object
|
(from-db-object
|
||||||
^DBObject (.findAndModify ^DBCollection coll ^DBObject (to-db-object conditions) maybe-fields maybe-sort remove
|
^DBObject (.findAndModify ^DBCollection coll (to-db-object conditions) maybe-fields maybe-sort remove
|
||||||
^DBObject (to-db-object document) return-new upsert) keywordize))))
|
(to-db-object document) return-new upsert) keywordize))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; monger.collection/find-by-id
|
;; monger.collection/find-by-id
|
||||||
|
|
@ -273,11 +273,11 @@
|
||||||
|
|
||||||
(monger.collection/count collection { :first_name \"Paul\" })"
|
(monger.collection/count collection { :first_name \"Paul\" })"
|
||||||
(^long [^String collection]
|
(^long [^String collection]
|
||||||
(.count ^DBCollection (.getCollection monger.core/*mongodb-database* collection)))
|
(.count (.getCollection monger.core/*mongodb-database* collection)))
|
||||||
(^long [^String collection ^Map conditions]
|
(^long [^String collection ^Map conditions]
|
||||||
(.count ^DBCollection (.getCollection monger.core/*mongodb-database* collection) (to-db-object conditions)))
|
(.count (.getCollection monger.core/*mongodb-database* collection) (to-db-object conditions)))
|
||||||
(^long [^DB db ^String collection ^Map conditions]
|
(^long [^DB db ^String collection ^Map conditions]
|
||||||
(.count ^DBCollection (.getCollection db collection) (to-db-object conditions))))
|
(.count (.getCollection db collection) (to-db-object conditions))))
|
||||||
|
|
||||||
(defn any?
|
(defn any?
|
||||||
"Wether the collection has any items at all, or items matching query.
|
"Wether the collection has any items at all, or items matching query.
|
||||||
|
|
@ -346,7 +346,7 @@
|
||||||
([^String collection ^Map conditions ^Map document & { :keys [upsert multi write-concern] :or { upsert false
|
([^String collection ^Map conditions ^Map document & { :keys [upsert multi write-concern] :or { upsert false
|
||||||
multi false
|
multi false
|
||||||
write-concern monger.core/*mongodb-write-concern* } }]
|
write-concern monger.core/*mongodb-write-concern* } }]
|
||||||
(.update ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.update (.getCollection monger.core/*mongodb-database* collection)
|
||||||
(to-db-object conditions)
|
(to-db-object conditions)
|
||||||
(to-db-object document)
|
(to-db-object document)
|
||||||
upsert
|
upsert
|
||||||
|
|
@ -358,7 +358,7 @@
|
||||||
[^String collection id ^Map document & { :keys [upsert write-concern] :or { upsert false
|
[^String collection id ^Map document & { :keys [upsert write-concern] :or { upsert false
|
||||||
write-concern monger.core/*mongodb-write-concern* } }]
|
write-concern monger.core/*mongodb-write-concern* } }]
|
||||||
(check-not-nil! id "id must not be nil")
|
(check-not-nil! id "id must not be nil")
|
||||||
(.update ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.update (.getCollection monger.core/*mongodb-database* collection)
|
||||||
(to-db-object { :_id id })
|
(to-db-object { :_id id })
|
||||||
(to-db-object document)
|
(to-db-object document)
|
||||||
upsert
|
upsert
|
||||||
|
|
@ -379,15 +379,15 @@
|
||||||
(monger.collection/save \"people\" { :first_name \"Ian\" :last_name \"Gillan\" })
|
(monger.collection/save \"people\" { :first_name \"Ian\" :last_name \"Gillan\" })
|
||||||
"
|
"
|
||||||
([^String collection ^Map document]
|
([^String collection ^Map document]
|
||||||
(.save ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.save (.getCollection monger.core/*mongodb-database* collection)
|
||||||
(to-db-object document)
|
(to-db-object document)
|
||||||
monger.core/*mongodb-write-concern*))
|
monger.core/*mongodb-write-concern*))
|
||||||
([^String collection ^Map document ^WriteConcern write-concern]
|
([^String collection ^Map document ^WriteConcern write-concern]
|
||||||
(.save ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.save (.getCollection monger.core/*mongodb-database* collection)
|
||||||
document
|
document
|
||||||
write-concern))
|
write-concern))
|
||||||
([^DB db ^String collection ^Map document ^WriteConcern write-concern]
|
([^DB db ^String collection ^Map document ^WriteConcern write-concern]
|
||||||
(.save ^DBCollection (.getCollection db collection)
|
(.save (.getCollection db collection)
|
||||||
document
|
document
|
||||||
write-concern)))
|
write-concern)))
|
||||||
|
|
||||||
|
|
@ -405,11 +405,11 @@
|
||||||
|
|
||||||
"
|
"
|
||||||
([^String collection]
|
([^String collection]
|
||||||
(.remove ^DBCollection (.getCollection monger.core/*mongodb-database* collection) (to-db-object {})))
|
(.remove (.getCollection monger.core/*mongodb-database* collection) (to-db-object {})))
|
||||||
([^String collection ^Map conditions]
|
([^String collection ^Map conditions]
|
||||||
(.remove ^DBCollection (.getCollection monger.core/*mongodb-database* collection) (to-db-object conditions)))
|
(.remove (.getCollection monger.core/*mongodb-database* collection) (to-db-object conditions)))
|
||||||
([^DB db ^String collection ^Map conditions]
|
([^DB db ^String collection ^Map conditions]
|
||||||
(.remove ^DBCollection (.getCollection db collection) (to-db-object conditions))))
|
(.remove (.getCollection db collection) (to-db-object conditions))))
|
||||||
|
|
||||||
|
|
||||||
(defn ^WriteResult remove-by-id
|
(defn ^WriteResult remove-by-id
|
||||||
|
|
@ -418,7 +418,7 @@
|
||||||
(remove-by-id monger.core/*mongodb-database* collection id))
|
(remove-by-id monger.core/*mongodb-database* collection id))
|
||||||
([^DB db ^String collection id]
|
([^DB db ^String collection id]
|
||||||
(check-not-nil! id "id must not be nil")
|
(check-not-nil! id "id must not be nil")
|
||||||
(let [^DBCollection coll (.getCollection db collection)]
|
(let [coll (.getCollection db collection)]
|
||||||
(.remove coll (to-db-object { :_id id })))))
|
(.remove coll (to-db-object { :_id id })))))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -437,13 +437,13 @@
|
||||||
|
|
||||||
"
|
"
|
||||||
([^String collection ^Map keys]
|
([^String collection ^Map keys]
|
||||||
(.createIndex ^DBCollection (.getCollection monger.core/*mongodb-database* collection) (to-db-object keys)))
|
(.createIndex (.getCollection monger.core/*mongodb-database* collection) (to-db-object keys)))
|
||||||
([^String collection ^Map keys options]
|
([^String collection ^Map keys options]
|
||||||
(.createIndex ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.createIndex (.getCollection monger.core/*mongodb-database* collection)
|
||||||
(to-db-object keys)
|
(to-db-object keys)
|
||||||
(to-db-object options)))
|
(to-db-object options)))
|
||||||
([^DB db ^String collection ^Map keys ^Map options]
|
([^DB db ^String collection ^Map keys ^Map options]
|
||||||
(.createIndex ^DBCollection (.getCollection db collection)
|
(.createIndex (.getCollection db collection)
|
||||||
(to-db-object keys)
|
(to-db-object keys)
|
||||||
(to-db-object options))))
|
(to-db-object options))))
|
||||||
|
|
||||||
|
|
@ -464,9 +464,9 @@
|
||||||
(monger.collection/ensure-index \"pages\" { :url 1 } {:unique true})
|
(monger.collection/ensure-index \"pages\" { :url 1 } {:unique true})
|
||||||
"
|
"
|
||||||
([^String collection, ^Map keys]
|
([^String collection, ^Map keys]
|
||||||
(.ensureIndex ^DBCollection (.getCollection monger.core/*mongodb-database* collection) (to-db-object keys)))
|
(.ensureIndex (.getCollection monger.core/*mongodb-database* collection) (to-db-object keys)))
|
||||||
([^String collection, ^Map keys ^Map options]
|
([^String collection, ^Map keys ^Map options]
|
||||||
(.ensureIndex ^DBCollection (.getCollection monger.core/*mongodb-database* collection)
|
(.ensureIndex (.getCollection monger.core/*mongodb-database* collection)
|
||||||
(to-db-object keys)
|
(to-db-object keys)
|
||||||
(to-db-object options)))
|
(to-db-object options)))
|
||||||
([^String collection ^Map keys ^String name ^Boolean unique?]
|
([^String collection ^Map keys ^String name ^Boolean unique?]
|
||||||
|
|
@ -499,16 +499,16 @@
|
||||||
(defn drop-index
|
(defn drop-index
|
||||||
"Drops an index from this collection."
|
"Drops an index from this collection."
|
||||||
([^String collection ^String name]
|
([^String collection ^String name]
|
||||||
(.dropIndex ^DBCollection (.getCollection monger.core/*mongodb-database* collection) name))
|
(.dropIndex (.getCollection monger.core/*mongodb-database* collection) name))
|
||||||
([^DB db ^String collection ^String name]
|
([^DB db ^String collection ^String name]
|
||||||
(.dropIndex ^DBCollection (.getCollection db collection) name)))
|
(.dropIndex (.getCollection db collection) name)))
|
||||||
|
|
||||||
(defn drop-indexes
|
(defn drop-indexes
|
||||||
"Drops an indices from this collection."
|
"Drops an indices from this collection."
|
||||||
([^String collection]
|
([^String collection]
|
||||||
(.dropIndexes ^DBCollection (.getCollection monger.core/*mongodb-database* collection)))
|
(.dropIndexes (.getCollection monger.core/*mongodb-database* collection)))
|
||||||
([^DB db ^String collection]
|
([^DB db ^String collection]
|
||||||
(.dropIndexes ^DBCollection (.getCollection db collection))))
|
(.dropIndexes (.getCollection db collection))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
@ -543,9 +543,9 @@
|
||||||
(monger.collection/drop \"collection-to-drop\")
|
(monger.collection/drop \"collection-to-drop\")
|
||||||
"
|
"
|
||||||
([^String collection]
|
([^String collection]
|
||||||
(.drop ^DBCollection (.getCollection monger.core/*mongodb-database* collection)))
|
(.drop (.getCollection monger.core/*mongodb-database* collection)))
|
||||||
([^DB db ^String collection]
|
([^DB db ^String collection]
|
||||||
(.drop ^DBCollection (.getCollection db collection))))
|
(.drop (.getCollection db collection))))
|
||||||
|
|
||||||
(defn rename
|
(defn rename
|
||||||
"Renames collection.
|
"Renames collection.
|
||||||
|
|
@ -555,11 +555,11 @@
|
||||||
(monger.collection/rename \"old_name\" \"new_name\")
|
(monger.collection/rename \"old_name\" \"new_name\")
|
||||||
"
|
"
|
||||||
([^String from, ^String to]
|
([^String from, ^String to]
|
||||||
(.rename ^DBCollection (.getCollection monger.core/*mongodb-database* from) to))
|
(.rename (.getCollection monger.core/*mongodb-database* from) to))
|
||||||
([^String from ^String to ^Boolean drop-target]
|
([^String from ^String to ^Boolean drop-target]
|
||||||
(.rename ^DBCollection (.getCollection monger.core/*mongodb-database* from) to drop-target))
|
(.rename (.getCollection monger.core/*mongodb-database* from) to drop-target))
|
||||||
([^DB db ^String from ^String to ^Boolean drop-target]
|
([^DB db ^String from ^String to ^Boolean drop-target]
|
||||||
(.rename ^DBCollection (.getCollection db from) to drop-target)))
|
(.rename (.getCollection db from) to drop-target)))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Map/Reduce
|
;; Map/Reduce
|
||||||
|
|
@ -568,10 +568,10 @@
|
||||||
(defn map-reduce
|
(defn map-reduce
|
||||||
"Performs a map reduce operation"
|
"Performs a map reduce operation"
|
||||||
([^String collection, ^String js-mapper, ^String js-reducer, ^String output, ^Map query]
|
([^String collection, ^String js-mapper, ^String js-reducer, ^String output, ^Map query]
|
||||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
|
(let [coll (.getCollection monger.core/*mongodb-database* collection)]
|
||||||
(.mapReduce coll js-mapper js-reducer output (to-db-object query))))
|
(.mapReduce coll js-mapper js-reducer output (to-db-object query))))
|
||||||
([^String collection, ^String js-mapper, ^String js-reducer, ^String output, ^MapReduceCommand$OutputType output-type, ^Map query]
|
([^String collection, ^String js-mapper, ^String js-reducer, ^String output, ^MapReduceCommand$OutputType output-type, ^Map query]
|
||||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
|
(let [coll (.getCollection monger.core/*mongodb-database* collection)]
|
||||||
(.mapReduce coll js-mapper js-reducer output output-type (to-db-object query)))))
|
(.mapReduce coll js-mapper js-reducer output output-type (to-db-object query)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -582,11 +582,11 @@
|
||||||
(defn distinct
|
(defn distinct
|
||||||
"Finds distinct values for a key"
|
"Finds distinct values for a key"
|
||||||
([^String collection ^String key]
|
([^String collection ^String key]
|
||||||
(.distinct ^DBCollection (.getCollection monger.core/*mongodb-database* collection) ^String (to-db-object key)))
|
(.distinct (.getCollection monger.core/*mongodb-database* collection) ^String (to-db-object key)))
|
||||||
([^String collection ^String key ^Map query]
|
([^String collection ^String key ^Map query]
|
||||||
(.distinct ^DBCollection (.getCollection monger.core/*mongodb-database* collection) ^String (to-db-object key) ^DBObject (to-db-object query)))
|
(.distinct (.getCollection monger.core/*mongodb-database* collection) ^String (to-db-object key) (to-db-object query)))
|
||||||
([^DB db ^String collection ^String key ^Map query]
|
([^DB db ^String collection ^String key ^Map query]
|
||||||
(.distinct ^DBCollection (.getCollection db collection) ^String (to-db-object key) ^DBObject (to-db-object query))))
|
(.distinct (.getCollection db collection) ^String (to-db-object key) (to-db-object query))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue