MongoDB driver
This extension provides the MongoDB integration for the Yii2 framework and allows you to work with MongoDB collection's records via the ActiveRecord-style
model.
Getting ready
- Create a new application by using composer, as described in the official guide at http://www.yiiframework.com/doc-2.0/guide-start-installation.html.
- Install MongoDB using the correct installation process from https://docs.mongodb.org/manual/installation/ for your system.
- Install the
php5-mongo
PHP extension. - Install the component with the following command:
composer require yiisoft/yii2-mongodb
How to do it…
- First of all, create the new MongoDB database. Run it in the
mongo-client
shell and type the database name:mongo > use mydatabase
- Add this connection information ...
Get Yii2 Application Development Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.