mongoDB-2.0.5: Driver (client) for MongoDB, a free, scalable, fast, document DBMS

Safe HaskellNone
LanguageHaskell2010

Database.MongoDB.Admin

Contents

Description

Database administrative functions

Synopsis

Admin

Collection

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 => 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

This operation takes a while

Index

data Index Source

Constructors

Index 

Instances

index :: Collection -> Order -> Index Source

Spec of index of ordered keys on collection. Name is generated from keys. Unique and dropDups are False.

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

getIndexes :: (MonadIO m, MonadBaseControl IO m, Functor 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

allUsers :: (MonadIO m, MonadBaseControl IO m, Functor m) => Action m [Document] Source

Fetch all users of this database

addUser :: MonadIO m => Bool -> Username -> Password -> Action m () Source

Add user with password with read-only access if bool is True or read-write access if bool is False

Database

admin :: Database Source

"admin" database

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.

dropDatabase :: MonadIO m => Database -> Action m Document Source

Delete the given database!

repairDatabase :: MonadIO m => Database -> Action m Document Source

Attempt to fix any corrupt records. This operation takes a while.

Server

Diagnotics

Collection

Profiling

Database

currentOp :: MonadIO m => Action m (Maybe Document) Source

See currently running operation on the database, if any

Server