NAME
MongoDBI::Document::Storage - MongoDBI Document Storage Interface
VERSION
version 0.0.9
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;
AUTHOR
Al Newkirk <awncorp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 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.