Dancer-Plugin-MongoDB

 view release on metacpan or  search on metacpan

Changelog  view on Meta::CPAN

0.35 - Remove stupid incomplete test. Ugh.
0.34 - Correct minor bug in authentication credentials.
0.33 - Correct some stuff to increase the kwalitee score.
0.32 - Prereq version fixes.
0.31 - Documentation fixes.
0.30 - Initial release.

lib/Dancer/Plugin/MongoDB.pm  view on Meta::CPAN

    my $dsn = 'mongodb://' .
        ( $settings->{host} || 'localhost' ) .
        ( defined $settings->{port} ? ':' . $settings->{port} : () );

    my $dbh = Mango->new($dsn);

    $dbh->default_db($settings->{db_name})
        if defined $settings->{db_name};

    if (defined $settings->{username} && defined $settings->{password}) {
        push @{$settings->{db_credentials}}, [ $settings->{db_name}, $settings->{username}, $settings->{password}];
    }


    if (defined $settings->{db_credentials} and ref $settings->{db_credentials} eq 'ARRAY') {
        $dbh->credentials($settings->{db_credentials});
    }

    if (defined $settings->{ioloop}) {
        my ( $module, $function ) = split(/\-\>/, $settings->{ioloop});
        $dbh->ioloop($module->$function);
    }

    if (defined $settings->{j}) {
        $dbh->j($settings->{j})
    };

lib/Dancer/Plugin/MongoDB.pm  view on Meta::CPAN


    plugins:
        MongoDB:
            host: "myhost"
            port: 27017
            db_name: "mydb"
            username: "myuser"
            password: "mypass"
            w: 1
            wtimeout: 1000
            credentials:
                [ mydb, myuser, mypass]
                [ myotherdb, myotheruser, myotherpass]

or:

    plugin:
        MongoDB:
            connections:
                foohost:
                    host: "foohost"



( run in 0.240 second using v1.01-cache-2.11-cpan-4d50c553e7e )