NAME

MongoDB::Admin - A collection of MongoDB administrative functions

SYNOPSIS

    use MongoDB;
    use MongoDB::Admin;

    my $connection = MongoDB::Connection->new(host => 'localhost', port => 27017);
    my $admin = MongoDB::Admin->new('connection' => $connection);

    my $ops = $admin->current_op();
    my $locked = $admin->fsync_lock_check();
    $admin->fsync_lock();
    $admin->fsync_unlock();

    $admin->killOp($opid);

METHODS

current_op()

    my $result = $database->current_op()

Print out the current operations running on the MongoDB server. akin to db.currentOp() at the mongo shell

fsync_lock_check()

    my $result = $conn->fsync_lock_check()

Checks if a fsync lock is in place, returning 1 if present, 0 otherwise.

fsync_lock()

    my $result = $conn->fsync_lock()

Force a fsync and then lock the database to write operations, does nothing if writes are already locked.

unlock()

    my $result = $conn->unlock()

Unlock's MongoDB from a prior fsync_lock operation.

killOp()

    my $result = $conn->killOp($opid)

Kill MongoDB Query with opid $opid

serverStatus()

    my $result = $conn->serverStatus()

Return the MongoDB server status detail

stats($db)

    my $result = $conn->stats($db)

Return the stats detail for the database named $db

serverBuildInfo()

    my $result = $conn->serverBuildInfo()
    print $result->{version};

Return the MongoDB server build info.

version()

    my $result = $conn->version()

Return the MongoDB server version.

rs_status()

    my $result = $conn->rs_status()

Return the replica set status.

rs_stepDown([$secs])

    my $result = $conn->rs_stepDown()

Step down as the master server, 60 second duration for new election on default.

rs_freeze([$secs])

    my $result = $conn->rs_freeze()

Freeze the replica member from becoming the new master for $secs seconds, or 60 seconds if undefined.

rs_conf()

    my $result = $conn->rs_conf()

Return the replica set config

AUTHOR

  David Burley <david@geek.net>