Introduce a way to run "raw" commands (using DBObjects)
This commit is contained in:
parent
413d4484b8
commit
555ac53d22
2 changed files with 13 additions and 1 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue