Sync with upstream

This commit is contained in:
Michael Klishin 2014-01-17 03:08:23 +04:00
commit 047dfeaafa
2 changed files with 8 additions and 8 deletions

View file

@ -6,7 +6,8 @@
[java.util List Map] [java.util List Map]
[java.lang Integer] [java.lang Integer]
[clojure.lang Keyword]) [clojure.lang Keyword])
(:require [monger.conversion :refer [to-db-object from-db-object as-field-selector]])) (:require [monger.core]
[monger.conversion :refer [to-db-object from-db-object as-field-selector]]))
(defn ^DBCursor make-db-cursor (defn ^DBCursor make-db-cursor
"initializes new db-cursor." "initializes new db-cursor."

View file

@ -26,8 +26,6 @@
;; Implementation ;; Implementation
;; ;;
(def ^{:dynamic true} *query-collection*)
;; ;;
;; Cursor/chain methods ;; Cursor/chain methods
;; ;;
@ -135,11 +133,12 @@
(defmacro with-collection (defmacro with-collection
[^String coll & body] [^String coll & body]
`(binding [*query-collection* (if (string? ~coll) `(let [coll# ~coll
(.getCollection ^DB monger.core/*mongodb-database* ~coll) db-coll# (if (string? coll#)
~coll)] (.getCollection ^DB monger.core/*mongodb-database* ^String coll#)
(let [query# (-> (empty-query *query-collection*) ~@body)] coll#)
(exec query#)))) query# (-> (empty-query db-coll#) ~@body)]
(exec query#)))
(defmacro partial-query (defmacro partial-query
[& body] [& body]