dropIndexes
This commit is contained in:
parent
7df946f697
commit
b413958ef7
2 changed files with 10 additions and 3 deletions
|
@ -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
2
TODO
|
@ -45,8 +45,6 @@ MongoDB
|
|||
* rename
|
||||
- index operations
|
||||
* ensureIndex
|
||||
* dropIndex
|
||||
* dropIndexes
|
||||
* getIndexInformation
|
||||
- misc operations
|
||||
* explain
|
||||
|
|
Loading…
Reference in a new issue