Add allow-disk-use option to aggregate

This commit adds the ability to pass the allowDiskUse option through to
MongoDB by adding an additional, optional parameter to the aggregate
function.
This commit is contained in:
Bartek Marcinowski 2015-06-07 21:48:10 +01:00
parent 9cb54167c4
commit 4fa6511432

View file

@ -494,8 +494,8 @@
"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 & [^Boolean allow-disk-use]]
(let [res (mc/command db {:aggregate coll :pipeline stages})] (let [res (mc/command db {:aggregate coll :pipeline stages :allowDiskUse (boolean allow-disk-use)})]
;; this is what DBCollection#distinct does. Turning a blind's eye! ;; this is what DBCollection#distinct does. Turning a blind's eye!
(.throwOnError res) (.throwOnError res)
(map #(from-db-object % true) (.get res "result")))) (map #(from-db-object % true) (.get res "result"))))