mongoDB-0.6.1: A driver for MongoDB

Database.MongoDB.Admin

Contents

Description

Database administrative functions

Synopsis

Admin

Collection

createCollection :: DbConn 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 :: DbConn m => Collection -> Collection -> m DocumentSource

Rename first collection to second collection

dropCollection :: DbConn 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 :: DbConn m => Collection -> m DocumentSource

This operation takes a while

Index

data Index Source

Constructors

Index 

Instances

index :: Collection -> Order -> IndexSource

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

ensureIndex :: DbConn 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 :: DbConn m => Index -> m ()Source

Create index on the server. This call goes to the server every time.

dropIndex :: DbConn m => Collection -> IndexName -> m DocumentSource

Remove the index

getIndexes :: DbConn m => Collection -> m [Document]Source

Get all indexes on this collection

dropIndexes :: DbConn m => Collection -> m DocumentSource

Drop all indexes on this collection

User

allUsers :: DbConn m => m [Document]Source

Fetch all users of this database

addUser :: DbConn 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

Database

cloneDatabase :: Conn m => Database -> Server -> m DocumentSource

Copy database from given server 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 :: Conn m => Database -> Server -> Maybe (Username, Password) -> Database -> m DocumentSource

Copy database from given server to the server I am connected to. If username & password is supplied use them to read from given server.

dropDatabase :: Conn m => Database -> m DocumentSource

Delete the given database!

repairDatabase :: Conn m => Database -> m DocumentSource

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

Server

Diagnotics

Collection

Profiling

Database

currentOp :: DbConn m => m (Maybe Document)Source

See currently running operation on the database, if any

Server