The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Plack::Middleware::Debug::Mongo::Database - Mongo database debug panel for Plack::Middleware::Debug

VERSION

version 0.03

SYNOPSIS

    # inside your psgi app
    enable 'Debug',
        panels => [
            [ 'Mongo::Database', connection => $options ],
        ];

DESCRIPTION

Plack::Middleware::Debug::Mongo::Database extends Plack::Middleware::Debug by adding MongoDB database statistics debug panel such as number of collections and indexes, average size of each document, total database and index size etc. This information can be obtained by command db.stats() in the mongo shell. See MongoDB Database Statistics Reference for details.

Additionally collection's statistics displayed for each collection of the database. It includes number of documents and indexes, total index and storage size, number of allocated data file regions, average size of an object in collection etc. More information and detailed description of the result see MongoDB Collection Statistics Reference.

Sample output

    Database: awl_devel

    Key                     Value
    avgObjSize              643.318918918919
    collections             8
    dataSize                476056
    db                      awl_devel
    fileSize                201326592
    indexSize               81760
    indexes                 6
    nsSizeMB                16
    numExtents              11
    objects                 740
    ok                      1
    storageSize             585728

    Collection: inventory

    Key                     Value
    avgObjSize              171.651090342679
    count                   321
    flags                   1
    indexSizes._id_         24528
    lastExtentSize          49152
    nindexes                1
    ns                      awl_devel.inventory
    numExtents              2
    ok                      1
    paddingFactor           1
    size                    55100
    storageSize             61440
    totalIndexSize          24528

    ...

METHODS

prepare_app

See Plack::Middleware::Debug

run

See Plack::Middleware::Debug

connection

MongoDB connection options. Passed as HASH reference. Default server to connect is mongodb://localhost:27017. For additional information please consult MongoDB::MongoClient page. Default database name is admin. You should change it to get fetch statistics of the desired database and its collections.

EXPORTED FUNCTIONS AND SUBROUTINES

Plack::Middleware::Debug::Mongo::Database doesn't export any functions and subroutines.

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/Wu-Wu/Plack-Middleware-Debug-Mongo/issues

SEE ALSO

Plack::Middleware::Debug

MongoDB::MongoClient

MongoDB Database Statistics Reference

MongoDB Collection Statistics Reference

AUTHOR

Anton Gerasimov <chim@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Anton Gerasimov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.