<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Mongoose - MongoDB document to Moose object mapper

VERSION
    version 0.02

SYNOPSIS
        package Person;
        use Moose;
        with 'Mongoose::Document';
        has 'name' =&gt; ( is =&gt; 'rw', isa =&gt; 'Str' );

        package main;
        use Mongoose;

        Mongoose-&gt;db('mydb');
        my $person = Person-&gt;new( name =&gt; 'Jack' );
        $person-&gt;save;

        my $person = Person-&gt;find_one( { name =&gt; 'Jack' } );
        say $person-&gt;name;    # Jack

        my $cursor = Person-&gt;find( { name =&gt; 'Jack' } );
        die "Not found" unless defined $cursor;
        while ( my $person = $cursor-&gt;next ) {
            say "You're " . $person-&gt;name;
        }

        $person-&gt;delete;

DESCRIPTION
    This is a MongoDB to Moose object mapper. This module allows you to use
    the full power of MongoDB within your Moose classes, without sacrificing
    MongoDB's power, flexibility and speed.

    It's loosely inspired by Ruby's MongoMapper, which is in turn loosely
    based on the ActiveRecord pattern.

    Start by reading the introduction Mongoose::Intro.

    Or proceed directly to the Mongoose::Cookbook for many day-to-day
    recipes.

METHODS
  db
    Sets the current MongoDB connection and/or db name.

            Mongoose-&gt;db( 'myappdb' );

    The connection defaults to whatever MongoDB defaults are (typically
    localhost:27017).

    For more control over the connection, "db" takes the same parameters as
    MongoDB::Connection, plus "db_name".

        my $db = Mongoose-&gt;db(
            host          =&gt; 'mongodb://localhost:27017',
            query_timeout =&gt; 60,
            db_name       =&gt; 'myapp'
        );

    This will, in turn, instantiate a MongoDB::Connection instance with all
    given parameters and return a MongoDB::Database object.

  load_schema
    Uses Module::Pluggable to "require" all modules under a given search
    path or search dir.

    All arguments will be sent to Module::Pluggable's "import", except for
    Mongoose specific ones.

            package main;
            use Mongoose;

            # to load a schema from a namespace path:
            Mongoose-&gt;load_schema( search_path=&gt;'MyApp::Schema' );

    This method can be used to shorten class names, aliasing them for
    convenience if you wish:

            Mongoose-&gt;load_schema( search_path=&gt;'MyApp::Schema', shorten=&gt;1 );

    Will shorten the module name to it's last bit:

            MyApp::Schema::Author-&gt;new( ... );

            # becomes

            Author-&gt;new( ... );

  naming
    By default, Mongoose composes the Mongo collection name from your
    package name by replacing double-colon "::" with underscores "_",
    separating camel-case, such as "aB" with "a_b" and uppercase with
    lowercase letters.

    This method let's you change this behaviour, by setting setting the
    collection naming default sub.

    The closure receives the package name as first parameter and should
    return the collection name.

        # let me change the naming strategy
        #  for my mongo collections
        #  to plain lowercase

        Mongoose-&gt;naming( sub { lc(shift) } );

  connection
    Sets/returns the current connection object, of class
    MongoDB::Connection.

    Defaults to whatever MongoDB defaults.

REPOSITORY
    Fork me on github: &lt;http://github.com/rodrigolive/mongoose&gt;

BUGS
    This is a WIP, barely *beta* quality software.

    Report bugs via RT. Send me test cases.

TODO
    * Better error control

    * Finish-up multiple database support

    * Allow query-&gt;fields to control which fields get expanded into the
    object.

    * Cleanup internals.

    * More tests and use cases.

    * Better documentation.

SEE ALSO
    KiokuDB

AUTHOR
            Rodrigo de Oliveira (rodrigolive), C&lt;rodrigolive@gmail.com&gt;

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

</pre></body></html>