Kelp::Module::MongoDB - Use MongoDB within Kelp
First ...
# conf/config.pl { modules => ['MongoDB'], modules_init => { MongoDB => { host => 'localhost', # example port => 27017, # example } } }
Then ...
package MyApp; use Kelp::Base 'Kelp'; sub some_route { my $self = shift; my $db = $self->mongodb->get_database('foodb'); my $collection = $db->get_collection('bar'); my $id = $collection->insert({some => 'data'}); my $data = $collection->find_one({_id => $id}); }
This module registers only one method into the application: mongodb. It is an instance of a MongoDB class.
mongodb
Adam Stokes <adam.stokes@ubuntu.com>
Perl
To install Kelp::Module::MongoDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Kelp::Module::MongoDB
CPAN shell
perl -MCPAN -e shell install Kelp::Module::MongoDB
For more information on module installation, please visit the detailed CPAN module installation guide.