{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Collection (ODM)","type":"basic","slug":"mvc-collection","excerpt":"","body":"# Collection\n\nThe collection acts as a document mapper for NoSQL.\n\n## Index:\n- [Configuration](#configuration)\n- [Generate a Collection](#generate)\n- [Learn More](#learn-more)\n\n\n---\n\n\n<a name=\"configuration\"></a>\n# Configuration\n\nThis component relies on ``config/database.php`` under ``nosql_adapters`` key\n\n```php\n'nosql_adapters' => [\n\n        'mongo1' => [\n            'host'     => 'localhost',\n            'port'     => '27017',\n            'username' => '',\n            'password' => '',\n            'dbname'   => 'mongo1',\n        ],\n    ],\n```\n\nCurrently, phalcon only supports MongoDB.\n\n---\n\n\n<a name=\"generate\"></a>\n# Generate a Collection\n\n```php\nphp brood make:collection TicketLogs\n> Crafting Collection...\n>    Collection has been created!\n```\n\nThe above code will generate a file containing a class that acts as our collection model, located at ``project-name/components/Collection/TicketLogs.php``.\n\n---\n\n\n<a name=\"learn-more\"></a>\n# Learn More\n\nTo learn more, you can fully review the whole collection\n\n- <a target=\"_blank\" href=\"https://docs.phalconphp.com/en/latest/reference/odm.html\">https://docs.phalconphp.com/en/latest/reference/odm.html</a>","updates":[],"order":4,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56e23cde7d54ba0e00463568","parentDoc":null,"user":"56c1105874f0b417004baadc","githubsync":"","createdAt":"2016-03-11T03:34:54.196Z","project":"56c111095abfe40d00be875a","version":{"version":"1.3.0","version_clean":"1.3.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["56c1110a5abfe40d00be875e","56c413a254b6030d00ec299d","56c4275048213b1700af6e33","56c42826c0c4630d004e86cb","56c4282cbc41330d009f2607","56c4284ad1f6d91700d3697e","56e271c195d1c60e00a969ee"],"_id":"56c111095abfe40d00be875d","releaseDate":"2016-02-14T23:43:05.566Z","__v":7,"createdAt":"2016-02-14T23:43:05.566Z","project":"56c111095abfe40d00be875a"},"__v":16,"category":{"sync":{"isSync":false,"url":""},"pages":["56d6449db939870b00512c63","56d648d270eba32d006060ae","56d648da70eba32d006060b0","56d648e870eba32d006060b2","56e23cde7d54ba0e00463568"],"title":"Modular-MVC","slug":"modular-mvc","order":2,"from_sync":false,"reference":false,"_id":"56c4275048213b1700af6e33","createdAt":"2016-02-17T07:54:56.500Z","project":"56c111095abfe40d00be875a","version":"56c111095abfe40d00be875d","__v":5}}
# Collection The collection acts as a document mapper for NoSQL. ## Index: - [Configuration](#configuration) - [Generate a Collection](#generate) - [Learn More](#learn-more) --- <a name="configuration"></a> # Configuration This component relies on ``config/database.php`` under ``nosql_adapters`` key ```php 'nosql_adapters' => [ 'mongo1' => [ 'host' => 'localhost', 'port' => '27017', 'username' => '', 'password' => '', 'dbname' => 'mongo1', ], ], ``` Currently, phalcon only supports MongoDB. --- <a name="generate"></a> # Generate a Collection ```php 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``. --- <a name="learn-more"></a> # Learn More To learn more, you can fully review the whole collection - <a target="_blank" href="https://docs.phalconphp.com/en/latest/reference/odm.html">https://docs.phalconphp.com/en/latest/reference/odm.html</a>