Implement monger.core/command
This commit is contained in:
parent
1f091ab735
commit
e681bf1a1c
2 changed files with 19 additions and 2 deletions
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
(ns monger.core
|
||||
(:refer-clojure :exclude [count])
|
||||
(:import (com.mongodb Mongo DB WriteConcern)))
|
||||
(:use [monger.convertion])
|
||||
(:import (com.mongodb Mongo DB WriteConcern DBObject)
|
||||
(java.util Map)))
|
||||
|
||||
;;
|
||||
;; Defaults
|
||||
|
|
@ -50,3 +52,8 @@
|
|||
com.mongodb.DBCursor
|
||||
(count [^com.mongodb.DBCursor this]
|
||||
(.count this)))
|
||||
|
||||
|
||||
(defn command
|
||||
[^Map cmd]
|
||||
(.command ^DB *mongodb-database* ^DBObject (to-db-object cmd)))
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
(ns monger.test.core
|
||||
(:require [monger.core])
|
||||
(:require [monger core collection util])
|
||||
(:import (com.mongodb Mongo DB))
|
||||
(:use [clojure.test]))
|
||||
|
||||
|
||||
(monger.util/with-ns 'monger.core
|
||||
(defonce ^:dynamic *mongodb-connection* (monger.core/connect))
|
||||
(defonce ^:dynamic *mongodb-database* (monger.core/get-db "monger-test")))
|
||||
|
||||
|
||||
(deftest connect-to-mongo-with-default-host-and-port
|
||||
(let [connection (monger.core/connect)]
|
||||
(is (instance? com.mongodb.Mongo connection))))
|
||||
|
|
@ -27,3 +33,7 @@
|
|||
;; (let [connection (monger.core/connect)
|
||||
;; db (monger.core/get-db connection "monger-test" "monger" "test_password")]
|
||||
;; (is (instance? com.mongodb.DB db))))
|
||||
|
||||
(deftest issuing-a-profiling-command
|
||||
(let [collection "things"]
|
||||
(monger.core/command { :profile 1 })))
|
||||
|
|
|
|||
Loading…
Reference in a new issue