Close Cursor in queries

This commit is contained in:
Tom McNulty 2013-01-10 21:01:09 -07:00 committed by Michael Klishin
parent c3d2ed0c74
commit 80219176a4

View file

@ -64,7 +64,7 @@
(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))