MongoDBI::Document::Storage - MongoDBI Document Storage Interface
version 0.0.12
package main; my $cds = CDDB::Album; ... $cds->connect(username => '...', password => '....'); 1;
MongoDBI::Document::Storage is a role that provides database-specific functionality to your MongoDBI document classes.
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;
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;
Al Newkirk <awncorp@cpan.org>
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.
To install MongoDBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MongoDBI
CPAN shell
perl -MCPAN -e shell install MongoDBI
For more information on module installation, please visit the detailed CPAN module installation guide.