Make monger.core/get-db-names return a set

This commit is contained in:
Michael S. Klishin 2012-02-20 16:06:05 +04:00
parent 7348ca9f2e
commit 7747325030
2 changed files with 4 additions and 6 deletions

View file

@ -52,14 +52,14 @@
([{ :keys [host port] :or { host *mongodb-host*, port *mongodb-port* }}]
(Mongo. ^String host ^Long port)))
(defn ^DB get-db-names
"Gets a list of all database names present on the server"
([]
(list (.getDatabaseNames *mongodb-connection*)))
(get-db-names *mongodb-connection*))
([^Mongo connection]
(list (.getDatabaseNames connection))))
(set (.getDatabaseNames connection))))
(defn ^DB get-db

View file

@ -31,9 +31,7 @@
(deftest test-get-db-names
(let [dbs (monger.core/get-db-names)]
(is (not (empty? dbs)))
(is (some #{"monger-test"} dbs))
)
)
(is (dbs "monger-test"))))
;; (deftest get-database-with-valid-credentials
;; (let [connection (monger.core/connect)