Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Database.MongoDB.Admin
Description
Database administrative functions
Synopsis
- data CollectionOption
- = Capped
- | MaxByteSize Int
- | MaxItems Int
- createCollection :: MonadIO m => [CollectionOption] -> Collection -> Action m Document
- renameCollection :: MonadIO m => Collection -> Collection -> Action m Document
- dropCollection :: (MonadIO m, MonadFail m) => Collection -> Action m Bool
- validateCollection :: MonadIO m => Collection -> Action m Document
- data Index = Index {}
- type IndexName = Text
- index :: Collection -> Order -> Index
- ensureIndex :: MonadIO m => Index -> Action m ()
- createIndex :: MonadIO m => Index -> Action m ()
- dropIndex :: MonadIO m => Collection -> IndexName -> Action m Document
- getIndexes :: MonadIO m => Collection -> Action m [Document]
- dropIndexes :: MonadIO m => Collection -> Action m Document
- allUsers :: MonadIO m => Action m [Document]
- addUser :: MonadIO m => Bool -> Username -> Password -> Action m ()
- removeUser :: MonadIO m => Username -> Action m ()
- admin :: Database
- cloneDatabase :: MonadIO m => Database -> Host -> Action m Document
- copyDatabase :: MonadIO m => Database -> Host -> Maybe (Username, Password) -> Database -> Action m Document
- dropDatabase :: MonadIO m => Database -> Action m Document
- repairDatabase :: MonadIO m => Database -> Action m Document
- serverBuildInfo :: MonadIO m => Action m Document
- serverVersion :: MonadIO m => Action m Text
- collectionStats :: MonadIO m => Collection -> Action m Document
- dataSize :: MonadIO m => Collection -> Action m Int
- storageSize :: MonadIO m => Collection -> Action m Int
- totalIndexSize :: MonadIO m => Collection -> Action m Int
- totalSize :: MonadIO m => Collection -> Action m Int
- data ProfilingLevel
- getProfilingLevel :: MonadIO m => Action m ProfilingLevel
- type MilliSec = Int
- setProfilingLevel :: MonadIO m => ProfilingLevel -> Maybe MilliSec -> Action m ()
- dbStats :: MonadIO m => Action m Document
- type OpNum = Int
- currentOp :: MonadIO m => Action m (Maybe Document)
- killOp :: MonadIO m => OpNum -> Action m (Maybe Document)
- serverStatus :: MonadIO m => Action m Document
Admin
Collection
data CollectionOption Source #
Constructors
Capped | |
MaxByteSize Int | |
MaxItems Int |
Instances
Show CollectionOption Source # | |
Defined in Database.MongoDB.Admin Methods showsPrec :: Int -> CollectionOption -> ShowS # show :: CollectionOption -> String # showList :: [CollectionOption] -> ShowS # | |
Eq CollectionOption Source # | |
Defined in Database.MongoDB.Admin Methods (==) :: CollectionOption -> CollectionOption -> Bool # (/=) :: CollectionOption -> CollectionOption -> Bool # |
createCollection :: MonadIO m => [CollectionOption] -> Collection -> Action m Document Source #
Create collection with given options. You only need to call this to set options, otherwise a collection is created automatically on first use with no options.
renameCollection :: MonadIO m => Collection -> Collection -> Action m Document Source #
Rename first collection to second collection
dropCollection :: (MonadIO m, MonadFail m) => Collection -> Action m Bool Source #
Delete the given collection! Return True
if collection existed (and was deleted); return False
if collection did not exist (and no action).
validateCollection :: MonadIO m => Collection -> Action m Document Source #
Validate the given collection, scanning the data and indexes for correctness. This operation takes a while.
Index
Constructors
Index | |
ensureIndex :: MonadIO m => Index -> Action m () Source #
Create index if we did not already create one. May be called repeatedly with practically no performance hit, because we remember if we already called this for the same index (although this memory gets wiped out every 15 minutes, in case another client drops the index and we want to create it again).
createIndex :: MonadIO m => Index -> Action m () Source #
Create index on the server. This call goes to the server every time.
dropIndex :: MonadIO m => Collection -> IndexName -> Action m Document Source #
Remove the index from the given collection.
getIndexes :: MonadIO m => Collection -> Action m [Document] Source #
Get all indexes on this collection
dropIndexes :: MonadIO m => Collection -> Action m Document Source #
Drop all indexes on this collection
User
addUser :: MonadIO m => Bool -> Username -> Password -> Action m () Source #
Add user with password with read-only access if the boolean argument is True
, or read-write access if it's False
Database
The "admin" database, which stores user authorization and authentication data plus other system collections.
cloneDatabase :: MonadIO m => Database -> Host -> Action m Document Source #
Copy database from given host to the server I am connected to. Fails and returns "ok" = 0
if we don't have permission to read from given server (use copyDatabase
in this case).
copyDatabase :: MonadIO m => Database -> Host -> Maybe (Username, Password) -> Database -> Action m Document Source #
Copy database from given host to the server I am connected to. If username & password is supplied use them to read from given host.
repairDatabase :: MonadIO m => Database -> Action m Document Source #
Attempt to fix any corrupt records. This operation takes a while.
Server
serverBuildInfo :: MonadIO m => Action m Document Source #
Return a document containing the parameters used to compile the server instance.
Diagnotics
Collection
collectionStats :: MonadIO m => Collection -> Action m Document Source #
Return some storage statistics for the given collection.
dataSize :: MonadIO m => Collection -> Action m Int Source #
Return the total uncompressed size (in bytes) in memory of all records in the given collection. Does not include indexes.
storageSize :: MonadIO m => Collection -> Action m Int Source #
Return the total bytes allocated to the given collection. Does not include indexes.
totalIndexSize :: MonadIO m => Collection -> Action m Int Source #
The total size in bytes of all indexes in this collection.
Profiling
data ProfilingLevel Source #
The available profiler levels.
Constructors
Off | No data collection. |
Slow | Data collected only for slow operations. The slow operation time threshold is 100ms by default, but can be changed using |
All | Data collected for all operations. |
Instances
Enum ProfilingLevel Source # | |
Defined in Database.MongoDB.Admin Methods succ :: ProfilingLevel -> ProfilingLevel # pred :: ProfilingLevel -> ProfilingLevel # toEnum :: Int -> ProfilingLevel # fromEnum :: ProfilingLevel -> Int # enumFrom :: ProfilingLevel -> [ProfilingLevel] # enumFromThen :: ProfilingLevel -> ProfilingLevel -> [ProfilingLevel] # enumFromTo :: ProfilingLevel -> ProfilingLevel -> [ProfilingLevel] # enumFromThenTo :: ProfilingLevel -> ProfilingLevel -> ProfilingLevel -> [ProfilingLevel] # | |
Show ProfilingLevel Source # | |
Defined in Database.MongoDB.Admin Methods showsPrec :: Int -> ProfilingLevel -> ShowS # show :: ProfilingLevel -> String # showList :: [ProfilingLevel] -> ShowS # | |
Eq ProfilingLevel Source # | |
Defined in Database.MongoDB.Admin Methods (==) :: ProfilingLevel -> ProfilingLevel -> Bool # (/=) :: ProfilingLevel -> ProfilingLevel -> Bool # |
getProfilingLevel :: MonadIO m => Action m ProfilingLevel Source #
Get the profiler level.
setProfilingLevel :: MonadIO m => ProfilingLevel -> Maybe MilliSec -> Action m () Source #
Set the profiler level, and optionally the slow operation time threshold (in milliseconds).
Database
dbStats :: MonadIO m => Action m Document Source #
Return some storage statistics for the given database.
currentOp :: MonadIO m => Action m (Maybe Document) Source #
See currently running operation on the database, if any
killOp :: MonadIO m => OpNum -> Action m (Maybe Document) Source #
Terminate the operation specified by the given OpNum
.