Dieser Post wurde aus meiner alten WordPress-Installation importiert. Sollte es Darstellungsprobleme, falsche Links oder fehlende Bilder geben, bitte einfach hier einen Kommentar hinterlassen. Danke.
I recently started my first Dancer & MongoDB project. MongoDB is my preferred database (at the moment) and Dancer is a great framework, but something is missing: I really prefer using an ORM and didn't find anything for MongoDB which fits my needs.

It turned out that YAWF::Object::MongoDB is great even with Dancer and without YAWF. I created a project module exporting two subs SERVER and DATABASE by default:
package MyProject::DB;A new section within the project configuration (or environment file) holds the database information:use strict;use warnings;
use Exporter;use Dancer ':syntax';
our @EXPORT=qw(SERVER DATABASE);our @ISA=qw(Exporter);
sub SERVER { return config()->{MongoDB}->{server} || 'localhost';}
sub DATABASE { return config()->{MongoDB}->{database};}
1;
MongoDB: server: "localhost" database: "MyProject"Every collection class for my project needs a use MyProject::DB; line - and I'm done. Even easier than DBIx::Class ;-)
Noch keine Kommentare. Schreib was dazu