Collection (ODM)

Collection

The collection acts as a document mapper for NoSQL.

Index:


Configuration

This component relies on config/database.php under nosql_adapters key

'nosql_adapters' => [

        'mongo1' => [
            'host'     => 'localhost',
            'port'     => '27017',
            'username' => '',
            'password' => '',
            'dbname'   => 'mongo1',
        ],
    ],

Currently, phalcon only supports MongoDB.


Generate a Collection

php brood make:collection TicketLogs
> Crafting Collection...
>    Collection has been created!

The above code will generate a file containing a class that acts as our collection model, located at project-name/components/Collection/TicketLogs.php.


Learn More

To learn more, you can fully review the whole collection