Close Cursor in queries
This commit is contained in:
parent
c3d2ed0c74
commit
80219176a4
1 changed files with 6 additions and 6 deletions
|
|
@ -64,12 +64,12 @@
|
||||||
|
|
||||||
(defn exec
|
(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 } }]
|
[{ :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 } }]
|
||||||
(let [cursor (doto (.find collection (to-db-object query) (as-field-selector fields))
|
(with-open [cursor (doto (.find collection (to-db-object query) (as-field-selector fields))
|
||||||
(.limit limit)
|
(.limit limit)
|
||||||
(.skip skip)
|
(.skip skip)
|
||||||
(.sort (to-db-object sort))
|
(.sort (to-db-object sort))
|
||||||
(.batchSize batch-size)
|
(.batchSize batch-size)
|
||||||
(.hint (to-db-object hint)))]
|
(.hint (to-db-object hint)))]
|
||||||
(when snapshot
|
(when snapshot
|
||||||
(.snapshot cursor))
|
(.snapshot cursor))
|
||||||
(when read-preference
|
(when read-preference
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue