Cosmetics

This commit is contained in:
Michael S. Klishin 2012-06-10 12:49:37 +04:00
parent bb5cfdc499
commit 52c5e15008

View file

@ -463,9 +463,9 @@
;; create a unique index
(monger.collection/ensure-index \"pages\" {:url 1} {:unique true})
"
([^String collection, ^Map keys]
([^String collection ^Map 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 (.getCollection monger.core/*mongodb-database* collection)
(to-db-object keys)
(to-db-object options)))
@ -567,10 +567,10 @@
(defn map-reduce
"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 [coll (.getCollection monger.core/*mongodb-database* collection)]
(.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 [coll (.getCollection monger.core/*mongodb-database* collection)]
(.mapReduce coll js-mapper js-reducer output output-type (to-db-object query)))))
@ -596,8 +596,8 @@
(defn create
"Creates a collection. Options are: :capped (pass true to create a capped collection), :max (number of documents)
and :size (max allowed size of the collection, in bytes)."
[^String name options]
(.createCollection ^DB monger.core/*mongodb-database* name (to-db-object options)))
[^String collection options]
(.createCollection ^DB monger.core/*mongodb-database* collection (to-db-object options)))
;;
;; Aggregation
@ -607,8 +607,8 @@
"Performs aggregation query. MongoDB 2.1/2.2+ only.
See http://docs.mongodb.org/manual/applications/aggregation/ to learn more."
[^String coll stages]
(let [res (monger.core/command {:aggregate coll :pipeline stages})]
[^String collection stages]
(let [res (monger.core/command {:aggregate collection :pipeline stages})]
;; this is what DBCollection#distinct does. Turning a blind eye!
(.throwOnError res)
(map #(from-db-object % true) (.get res "result"))))
@ -624,5 +624,5 @@
(defn system-collection?
"Evaluates to true if the given collection name refers to a system collection. System collections
are prefixed with system. or fs. (default GridFS collection prefix)"
[^String coll-name]
(re-find system-collection-pattern coll-name))
[^String collection]
(re-find system-collection-pattern collection))