diff --git a/Database/MongoDB.hs b/Database/MongoDB.hs index ec1b60f..ad90c71 100644 --- a/Database/MongoDB.hs +++ b/Database/MongoDB.hs @@ -28,6 +28,7 @@ module Database.MongoDB -- * Connection Connection, connect, connectOnPort, conClose, disconnect, + dropDatabase, -- * Database Database, MongoDBCollectionInvalid, ColCreateOpt(..), @@ -93,6 +94,12 @@ conClose = hClose . cHandle disconnect :: Connection -> IO () 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/. collectionNames :: Connection -> Database -> IO [Collection] collectionNames c db = do diff --git a/TODO b/TODO index b8fc71a..348c097 100644 --- a/TODO +++ b/TODO @@ -25,7 +25,6 @@ MongoDB * getName * getCollection * executeCommand - * dropDatabase (erase) * add_son_manipulators * authenticate * dereference (dbref)