dropIndexes

This commit is contained in:
Scott R. Parish 2010-01-20 06:20:30 -06:00
parent 7df946f697
commit b413958ef7
2 changed files with 10 additions and 3 deletions

View file

@ -48,7 +48,7 @@ module Database.MongoDB
-- * Index
Key, Unique,
Direction(..),
createIndex, dropIndex,
createIndex, dropIndex, dropIndexes,
)
where
import Control.Exception
@ -654,6 +654,15 @@ dropIndex c col keys = do
("index", toBson name)]
return ()
-- | Drop all indexes on /FullCollection/.
dropIndexes :: Connection -> FullCollection -> IO ()
dropIndexes c col = do
let (db, col') = splitFullCol col
_ <- runCommand c db $ toBsonDoc [("deleteIndexes", toBson col'),
("index", toBson "*")]
return ()
indexName :: [(Key, Direction)] -> String
indexName = List.concat . List.intersperse "_" . fmap partName
where partName (k, Ascending) = k ++ "_1"

2
TODO
View file

@ -45,8 +45,6 @@ MongoDB
* rename
- index operations
* ensureIndex
* dropIndex
* dropIndexes
* getIndexInformation
- misc operations
* explain