dropDatabase

This commit is contained in:
Scott R. Parish 2010-01-18 21:31:21 -06:00
parent 9b32259dc8
commit 6569157051
2 changed files with 7 additions and 1 deletions

View file

@ -28,6 +28,7 @@ module Database.MongoDB
-- * Connection -- * Connection
Connection, Connection,
connect, connectOnPort, conClose, disconnect, connect, connectOnPort, conClose, disconnect,
dropDatabase,
-- * Database -- * Database
Database, MongoDBCollectionInvalid, Database, MongoDBCollectionInvalid,
ColCreateOpt(..), ColCreateOpt(..),
@ -93,6 +94,12 @@ conClose = hClose . cHandle
disconnect :: Connection -> IO () disconnect :: Connection -> IO ()
disconnect = conClose disconnect = conClose
-- | Drop a database.
dropDatabase :: Connection -> Database -> IO ()
dropDatabase c db = do
_ <- dbCmd c db $ toBsonDoc [("dropDatabase", toBson (1::Int))]
return ()
-- | Return a list of collections in /Database/. -- | Return a list of collections in /Database/.
collectionNames :: Connection -> Database -> IO [Collection] collectionNames :: Connection -> Database -> IO [Collection]
collectionNames c db = do collectionNames c db = do

1
TODO
View file

@ -25,7 +25,6 @@ MongoDB
* getName * getName
* getCollection * getCollection
* executeCommand * executeCommand
* dropDatabase (erase)
* add_son_manipulators * add_son_manipulators
* authenticate * authenticate
* dereference (dbref) * dereference (dbref)