Introduce monger.core/disconnect!

Closes #42
This commit is contained in:
Michael S. Klishin 2012-10-24 07:57:09 +04:00
parent 2fb74c6aff
commit 2818ac6c26
3 changed files with 15 additions and 3 deletions

View file

@ -1,13 +1,18 @@
## Changes between 1.2.0 and 1.3.0
### monger.core/disconnect!
`monger.core/disconnect!` closes the default database connection.
### Ragtime 0.3.0
Ragtime dependency has been updated to 0.3.0.
### MongoDB Java driver 2.9.1
### MongoDB Java Driver Update
MongoDB Java driver dependency has been updated to 2.9.1.
MongoDB Java driver dependency has been updated to 2.9.2.
### Cheshire Support

View file

@ -181,7 +181,10 @@
(let [c (apply connect args)]
(set-connection! c)))
(defn disconnect!
"Closes default connection to MongoDB"
[]
(.close *mongodb-connection*))
(defn set-db!
"Sets *mongodb-database* var to given db, updates *mongodb-gridfs* var state. Recommended to be used for

View file

@ -13,6 +13,10 @@
(let [connection (monger.core/connect)]
(is (instance? com.mongodb.Mongo connection))))
(deftest connect-and-disconnect
(monger.core/connect!)
(monger.core/disconnect!)
(monger.core/connect!))
(deftest connect-to-mongo-with-default-host-and-explicit-port
(let [connection (monger.core/connect { :port 27017 })]