Add and expose serverShutdown.

This commit is contained in:
Brian Gianforcaro 2010-01-26 04:02:47 -05:00
parent e8be496011
commit 39eec96357

View file

@ -28,7 +28,7 @@ module Database.MongoDB
-- * Connection -- * Connection
Connection, Connection,
connect, connectOnPort, conClose, disconnect, dropDatabase, connect, connectOnPort, conClose, disconnect, dropDatabase,
serverInfo, serverInfo, serverShutdown,
databasesInfo, databaseNames, databasesInfo, databaseNames,
-- * Database -- * Database
Database, MongoDBCollectionInvalid, Database, MongoDBCollectionInvalid,
@ -126,6 +126,14 @@ serverInfo :: Connection -> IO BsonDoc
serverInfo c = serverInfo c =
runCommand c (s2L "admin") $ toBsonDoc [("buildinfo", toBson (1::Int))] 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/. -- | Return a list of collections in /Database/.
collectionNames :: Connection -> Database -> IO [FullCollection] collectionNames :: Connection -> Database -> IO [FullCollection]
collectionNames c db = do collectionNames c db = do