From 6569157051cee7dce59f22131cb055c0ec945a28 Mon Sep 17 00:00:00 2001 From: "Scott R. Parish" Date: Mon, 18 Jan 2010 21:31:21 -0600 Subject: [PATCH] dropDatabase --- Database/MongoDB.hs | 7 +++++++ TODO | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) 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)