Mongol - MongoDB ODM for Moose objects
package Models::Person { use Moose; extends 'Mongol::Model'; with 'Mongol::Roles::Core'; with 'Mongol::Roles::Pagination'; has 'first_name' => ( is => 'ro', isa => 'Str', required => 1, ); has 'last_name' => ( is => 'ro', isa => 'Str', required => 1, ); __PACKAGE__->meta()->make_immutable(); } package main { ... use MongoDB; use Mongol; my $mongo = MongoDB->connect(...); Mongol->map_entities( $mongo, 'Models::Person' => 'test.people', ... ); ... }
Mongol->map_entities( $mongo_connection, 'My::Model::Class' => 'db.collection', 'My::Model::Other' => 'db.other_collection', );
Using a given MongoDB connection will automatically map a model class to a collection. After each initialization if exists the setup method on the model will be called.
Tudor Marghidanu <tudor@marghidanu.com>
Moose
MongoDB
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
To install Mongol, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mongol
CPAN shell
perl -MCPAN -e shell install Mongol
For more information on module installation, please visit the detailed CPAN module installation guide.