From 78a526d9d7cc960ef02f35f58c700778628cb427 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Tue, 26 Jan 2010 04:02:47 -0500 Subject: [PATCH] Add and expose serverShutdown. Signed-off-by: Scott R. Parish --- Database/MongoDB.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Database/MongoDB.hs b/Database/MongoDB.hs index 9ef6b78..f157d9a 100644 --- a/Database/MongoDB.hs +++ b/Database/MongoDB.hs @@ -28,7 +28,7 @@ module Database.MongoDB -- * Connection Connection, connect, connectOnPort, conClose, disconnect, dropDatabase, - serverInfo, + serverInfo, serverShutdown, databasesInfo, databaseNames, -- * Database Database, MongoDBCollectionInvalid, @@ -126,6 +126,14 @@ serverInfo :: Connection -> IO BsonDoc serverInfo c = runCommand c (s2L "admin") $ toBsonDoc [("buildinfo", toBson (1::Int))] +-- | Shut down the MongoDB server. +-- +-- Force a clean exit, flushing and closing all data files. +-- Note that it will wait until all ongoing operations are complete. +serverShutdown:: Connection -> IO BsonDoc +serverShutdown c = + runCommand c (s2L "admin") $ toBsonDoc [("shutdown", toBson (1::Int))] + -- | Return a list of collections in /Database/. collectionNames :: Connection -> Database -> IO [FullCollection] collectionNames c db = do