Database.MongoDB.Admin
Description
Database administrative functions
- data CollectionOption
- = Capped
- | MaxByteSize Int
- | MaxItems Int
- createCollection :: DbAccess m => [CollectionOption] -> Collection -> m Document
- renameCollection :: DbAccess m => Collection -> Collection -> m Document
- dropCollection :: DbAccess m => Collection -> m Bool
- validateCollection :: DbAccess m => Collection -> m Document
- data Index = Index {}
- type IndexName = UString
- index :: Collection -> Order -> Index
- ensureIndex :: DbAccess m => Index -> m ()
- createIndex :: DbAccess m => Index -> m ()
- dropIndex :: DbAccess m => Collection -> IndexName -> m Document
- getIndexes :: DbAccess m => Collection -> m [Document]
- dropIndexes :: DbAccess m => Collection -> m Document
- allUsers :: DbAccess m => m [Document]
- addUser :: DbAccess m => Bool -> Username -> Password -> m ()
- removeUser :: DbAccess m => Username -> m ()
- admin :: Database
- cloneDatabase :: Access m => Database -> Host -> m Document
- copyDatabase :: Access m => Database -> Host -> Maybe (Username, Password) -> Database -> m Document
- dropDatabase :: Access m => Database -> m Document
- repairDatabase :: Access m => Database -> m Document
- serverBuildInfo :: Access m => m Document
- serverVersion :: Access m => m UString
- collectionStats :: DbAccess m => Collection -> m Document
- dataSize :: DbAccess m => Collection -> m Int
- storageSize :: DbAccess m => Collection -> m Int
- totalIndexSize :: DbAccess m => Collection -> m Int
- totalSize :: DbAccess m => Collection -> m Int
- data ProfilingLevel
- getProfilingLevel :: DbAccess m => m ProfilingLevel
- type MilliSec = Int
- setProfilingLevel :: DbAccess m => ProfilingLevel -> Maybe MilliSec -> m ()
- dbStats :: DbAccess m => m Document
- type OpNum = Int
- currentOp :: DbAccess m => m (Maybe Document)
- killOp :: DbAccess m => OpNum -> m (Maybe Document)
- serverStatus :: Access m => m Document
Admin
Collection
createCollection :: DbAccess m => [CollectionOption] -> Collection -> m DocumentSource
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 :: DbAccess m => Collection -> Collection -> m DocumentSource
Rename first collection to second collection
dropCollection :: DbAccess m => Collection -> m BoolSource
Delete the given collection! Return True if collection existed (and was deleted); return False if collection did not exist (and no action).
validateCollection :: DbAccess m => Collection -> m DocumentSource
This operation takes a while
Index
Constructors
Index | |
index :: Collection -> Order -> IndexSource
Spec of index of ordered keys on collection. Name is generated from keys. Unique and dropDups are False.
ensureIndex :: DbAccess m => Index -> 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 :: DbAccess m => Index -> m ()Source
Create index on the server. This call goes to the server every time.
getIndexes :: DbAccess m => Collection -> m [Document]Source
Get all indexes on this collection
dropIndexes :: DbAccess m => Collection -> m DocumentSource
Drop all indexes on this collection
User
addUser :: DbAccess m => Bool -> Username -> Password -> m ()Source
Add user with password with read-only access if bool is True or read-write access if bool is False
removeUser :: DbAccess m => Username -> m ()Source
Database
cloneDatabase :: Access m => Database -> Host -> m DocumentSource
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 :: Access m => Database -> Host -> Maybe (Username, Password) -> Database -> m DocumentSource
Copy database from given host to the server I am connected to. If username & password is supplied use them to read from given host.
dropDatabase :: Access m => Database -> m DocumentSource
Delete the given database!
repairDatabase :: Access m => Database -> m DocumentSource
Attempt to fix any corrupt records. This operation takes a while.
Server
serverBuildInfo :: Access m => m DocumentSource
serverVersion :: Access m => m UStringSource
Diagnotics
Collection
collectionStats :: DbAccess m => Collection -> m DocumentSource
dataSize :: DbAccess m => Collection -> m IntSource
storageSize :: DbAccess m => Collection -> m IntSource
totalIndexSize :: DbAccess m => Collection -> m IntSource
totalSize :: DbAccess m => Collection -> m IntSource
Profiling
data ProfilingLevel Source
Instances
getProfilingLevel :: DbAccess m => m ProfilingLevelSource
setProfilingLevel :: DbAccess m => ProfilingLevel -> Maybe MilliSec -> m ()Source
Database
currentOp :: DbAccess m => m (Maybe Document)Source
See currently running operation on the database, if any
Server
serverStatus :: Access m => m DocumentSource