Support aggregation options, closes #102
This commit is contained in:
parent
aeab2851c1
commit
94029c7f6c
1 changed files with 7 additions and 5 deletions
|
|
@ -523,11 +523,13 @@
|
||||||
"Executes an aggregation query. MongoDB 2.2+ only.
|
"Executes an aggregation query. MongoDB 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."
|
||||||
[^DB db ^String coll stages]
|
([^DB db ^String coll stages]
|
||||||
(let [res (mc/command db {:aggregate coll :pipeline stages})]
|
(aggregate db coll stages {}))
|
||||||
;; this is what DBCollection#distinct does. Turning a blind's eye!
|
([^DB db ^String coll stages opts]
|
||||||
(.throwOnError res)
|
(let [res (mc/command db (merge {:aggregate coll :pipeline stages} opts))]
|
||||||
(map #(from-db-object % true) (.get res "result"))))
|
;; this is what DBCollection#distinct does. Turning a blind's eye!
|
||||||
|
(.throwOnError res)
|
||||||
|
(map #(from-db-object % true) (.get res "result")))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue