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