NAME

Nile::Plugin::MongoDB - MongoDB plugin for the Nile framework.

SYNOPSIS

    # connect to MongoDB server
    $client = $app->plugin->MongoDB->client;
    
    # connect to database
    my $db = $client->get_database("db_name");

    # connect to collection/table
    my $table = $db->get_collection("users");

    my $id = $table->insert({ some => 'data' });
    my $data = $table->find_one({ _id => $id });

DESCRIPTION

Nile::Plugin::MongoDB - MongoDB plugin for the Nile framework.

Plugin settings in th config file under plugin section.

    <plugin>

        <mongodb>
            <server>localhost</server>
            <port>27017</port>
            <database></database>
            <collection></collection>
        </mongodb>

    </plugin>

client()

    # connect to MongoDB server
    $client = $app->plugin->MongoDB->client;
    

Returns the MongoDB::MongoClient object instance used. All MongoDB::MongoClient methods can be accessed through this method.

Bugs

This project is available on github at https://github.com/mewsoft/Nile.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Nile.

SOURCE

Source repository is at https://github.com/mewsoft/Nile.

SEE ALSO

See Nile for details about the complete framework.

AUTHOR

Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.