Al Newkirk > MongoDBI > MongoDBI::Document::Storage

Download:
MongoDBI-0.02.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

MongoDBI::Document::Storage - MongoDBI Document Storage Interface

VERSION ^

version 0.02

SYNOPSIS ^

    package main;

    my $cds = CDDB::Album;
    
    ...
    
    $cds->connect(username => '...', password => '....');
    
    1;

DESCRIPTION ^

MongoDBI::Document::Storage is a role that provides database-specific functionality to your MongoDBI document classes.

METHODS ^

connect

The connect method is responsible for establishing the document class's connection to the MongoDB database. This methods accepts all valid arguments accepted by MongoDB::Connection.

It is important to note that if no collection name exists when the connect method is called ... an attempt to auto generate one for you will be made. Also, it is likely that your connection will fail unless a database name is set.

    package main;

    my $cds = CDDB::Album;
    
    $cds->config->set_database('test');
    
    $cds->connect(username => '...', password => '....');
    
    1;

disconnect

The disconnect method doesn't actually disconnect you from the database server, it merely nullifies the MongoDB::Connection object set in your document classes configuration. This method can be used to switch between and perform operations across database hosts/connections.

    package main;

    my $cds = CDDB::Album;
    
    $cds->config->set_database('test');
    
    $cds->connect(username => '...', password => '....');
    
    ...
    
    $cds->disconnect;
    
    1;

AUTHORS ^

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by awncorp.

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

syntax highlighting: