Torsten Raudssus > Catalyst-Model-MongoDB-0.07 > Catalyst::Model::MongoDB

Download:
Catalyst-Model-MongoDB-0.07.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.06   Source   Latest Release: Catalyst-Model-MongoDB-0.12

NAME ^

Catalyst::Model::MongoDB - MongoDB model class for Catalyst

VERSION ^

version 0.07

SYNOPSIS ^

    #
    # Config
    #
    <Model::MyModel>
        host localhost
        port 27017
        dbname mydatabase
        collectionname preferedcollection
        gridfs preferedgridfs
    </Model::MyModel>

    #
    # Usage
    #
    $c->model('MyModel')->db                           # returns MongoDB::Connection->mydatabase
    $c->model('MyModel')->db('otherdb')                # returns ->otherdb
    $c->model('MyModel')->collection                   # returns ->mydatabase->preferedcollection
    $c->model('MyModel')->coll                         # the same...
    $c->model('MyModel')->c                            # the same...
    $c->model('MyModel')->c('otherdb.othercollection') # returns ->otherdb->othercollection
    $c->model('MyModel')->c('somecollection')          # returns ->mydatabase->somecollection
    $c->model('MyModel')->gridfs                       # returns ->mydatabase->get_gridfs('preferedgridfs')
    $c->model('MyModel')->g                            # the same...
    $c->model('MyModel')->g('somegridfs')              # returns ->mydatabase->get_gridfs('somegridfs')
    $c->model('MyModel')->g('otherdb.othergridfs')     # returns ->otherdb->get_gridfs('othergridfs')

    $c->model('MyModel')->run(...)                     # returns ->mydatabase->run_command(...)
    $c->model('MyModel')->eval(...)                    # returns ->mydatabase->eval(...)

    $c->model('MyModel')->database_names               # returns ->database_names
    $c->model('MyModel')->dbnames                      # the same...

DESCRIPTION ^

This model class exposes MongoDB::Connection as a Catalyst model.

CONFIGURATION ^

You can pass the same configuration fields as when you make a new MongoDB::Connection.

In addition you can also give a database name via dbname, a collection name via collectioname or a gridfs name via gridfsname.

METHODS ^

dbnames

database_names

List of databases.

collnames

collection_names

List of collection names of the default database. You cant give other database names here, if you need this please do:

  $c->model('MyModel')->db('otherdatabase')->collection_names

collection

coll

c

Gives back a MongoDB::Collection, you can also directly access other dbs collections, with "otherdb.othercollection". If no collectionname is given he uses the default collectionname given on config.

gridfs

g

Gives back a MongoDB::GridFS. If no gridfsname is given, he uses the default gridfsname given on config.

run

Run a command via MongoDB::Database->run_command on the default database. You cant give other database names here, if you need this please do:

  $c->model('MyModel')->db('otherdatabase')->run_command(...)

eval

Eval code via MongoDB::Database->eval on the default database. You cant give other database names here, if you need this please do:

  $c->model('MyModel')->db('otherdatabase')->eval(...)

oid

Creates MongoDB::OID object

SUPPORT ^

IRC

  Join #catalyst on irc.perl.org and ask for Getty.

Repository

  http://github.com/Getty/p5-catalyst-model-mongodb
  Pull request and additional contributors are welcome

Issue Tracker

  http://github.com/Getty/p5-catalyst-model-mongodb/issues

AUTHOR ^

Torsten Raudssus <torsten@raudssus.de> http://www.raudssus.de/

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2010 by Raudssus Social Software.

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

syntax highlighting: