Merge f133fbe256 into b72968dfb9
This commit is contained in:
commit
bbda2189a6
2 changed files with 16 additions and 12 deletions
|
|
@ -7,7 +7,8 @@
|
|||
[org.mongodb/mongo-java-driver "2.11.2"]
|
||||
[com.novemberain/validateur "1.5.0"]
|
||||
[clojurewerkz/support "0.19.0"]
|
||||
[ragtime/ragtime.core "0.3.4"]]
|
||||
[ragtime/ragtime.core "0.3.4"]
|
||||
[clj-yield "1.1"]]
|
||||
:test-selectors {:default (fn [m]
|
||||
(and (not (:performance m))
|
||||
(not (:edge-features m))
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
[monger.cursor :as cursor :refer [add-options]])
|
||||
(:import [com.mongodb DB DBCollection DBObject DBCursor ReadPreference]
|
||||
[java.util List])
|
||||
(:use [monger conversion operators]))
|
||||
(:use [monger conversion operators]
|
||||
[yield]))
|
||||
|
||||
|
||||
;;
|
||||
|
|
@ -65,6 +66,7 @@
|
|||
|
||||
(defn exec
|
||||
[{ :keys [^DBCollection collection query fields skip limit sort batch-size hint snapshot read-preference keywordize-fields options] :or { limit 0 batch-size 256 skip 0 } }]
|
||||
(with-yielding [y-out 1]
|
||||
(with-open [cursor (doto (.find collection (to-db-object query) (as-field-selector fields))
|
||||
(.limit limit)
|
||||
(.skip skip)
|
||||
|
|
@ -77,9 +79,10 @@
|
|||
(.setReadPreference cursor read-preference))
|
||||
(when options
|
||||
(add-options cursor options))
|
||||
(map (fn [x] (from-db-object x keywordize-fields))
|
||||
cursor)))
|
||||
|
||||
(loop []
|
||||
(when (.hasNext cursor)
|
||||
(yield y-out (from-db-object (.next cursor) keywordize-fields))
|
||||
(recur))))))
|
||||
;;
|
||||
;; API
|
||||
;;
|
||||
|
|
|
|||
Loading…
Reference in a new issue