From ba53b4b7e8d5f53c380915dfc3c9bf2ef526ed80 Mon Sep 17 00:00:00 2001 From: "Scott R. Parish" Date: Mon, 18 Jan 2010 22:20:01 -0600 Subject: [PATCH] forgot docs for validateCollection and dropCollection --- Database/MongoDB.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Database/MongoDB.hs b/Database/MongoDB.hs index b3fa732..8782fb8 100644 --- a/Database/MongoDB.hs +++ b/Database/MongoDB.hs @@ -153,6 +153,7 @@ createCollection c col opts = do _ <- dbCmd c db $ toBsonDoc cmd return () +-- | Drop a collection. dropCollection :: Connection -> Collection -> IO () dropCollection c col = do let db = dbFromCol col @@ -160,6 +161,29 @@ dropCollection c col = do _ <- dbCmd c db $ toBsonDoc [("drop", toBson col')] return () +-- | Return a string of validation info about the collection. +-- +-- Example output (note this probably can/will change with different +-- versions of the server): +-- +-- > validate +-- > details: 0x7fe5cc2c1da4 ofs:e7da4 +-- > firstExtent:0:24100 ns:test.foo.bar +-- > lastExtent:0:24100 ns:test.foo.bar +-- > # extents:1 +-- > datasize?:180 nrecords?:5 lastExtentSize:1024 +-- > padding:1 +-- > first extent: +-- > loc:0:24100 xnext:null xprev:null +-- > nsdiag:test.foo.bar +-- > size:1024 firstRecord:0:241e4 lastRecord:0:24280 +-- > 5 objects found, nobj:5 +-- > 260 bytes data w/headers +-- > 180 bytes data wout/headers +-- > deletedList: 0100100000000000000 +-- > deleted: n: 4 size: 588 +-- > nIndexes:1 +-- > test.foo.bar.$_id_ keys:5 validateCollection :: Connection -> Collection -> IO String validateCollection c col = do let db = dbFromCol col