diff --git a/src/clojure/monger/command.clj b/src/clojure/monger/command.clj index b8e78a4..5e3e8fb 100644 --- a/src/clojure/monger/command.clj +++ b/src/clojure/monger/command.clj @@ -20,7 +20,7 @@ * http://clojuremongodb.info/articles/mapreduce.html" (:require monger.core [monger.conversion :refer :all]) - (:import com.mongodb.DB)) + (:import [com.mongodb DB DBObject])) ;; @@ -32,6 +32,11 @@ [m] (monger.core/command (monger.core/admin-db) m)) +(defn raw-admin-command + "Executes a command on the admin database" + [^DBObject cmd] + (monger.core/raw-command (monger.core/admin-db) cmd)) + (defn collection-stats ([collection] (collection-stats monger.core/*mongodb-database* collection)) diff --git a/src/clojure/monger/core.clj b/src/clojure/monger/core.clj index 82ab647..7307dcb 100644 --- a/src/clojure/monger/core.clj +++ b/src/clojure/monger/core.clj @@ -263,6 +263,13 @@ ([^DB database ^Map cmd] (.command ^DB database ^DBObject (to-db-object cmd)))) +(defn ^com.mongodb.CommandResult raw-command + "Like monger.core/command but accepts DBObjects" + ([^DBObject cmd] + (.command ^DB *mongodb-database* cmd)) + ([^DB database ^DBObject cmd] + (.command database cmd))) + (defprotocol Countable (count [this] "Returns size of the object"))