Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB configuration in CakePHP 3.x

All data I found on the Internet is about CakePHP V2. In V3 I can't configure MongoDB with cakePHP 3. I dont know how to configure datasource for mongoDB. My Default Databse Configuration is as follows:

'Datasources' => [
    'default' => [
        'className' => 'Cake\Database\Connection',
        'driver' => 'Cake\Database\Driver\Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'username' => 'root',
        'password' => '',
        'database' => 'users',
        'encoding' => 'utf8',
        'timezone' => 'UTC',
        'cacheMetadata' => true,
        'quoteIdentifiers' => false,
    ]
] 
like image 593
Jamshaid Tariq Avatar asked Mar 15 '23 19:03

Jamshaid Tariq


1 Answers

This is not a solution but will give you an insight of cakePHP 3 with mongoDB. There is no support for mongodb datasource for cakePHP 3 as for now.The most you can do is create a new one Like ichikaway did for cakePHP 2. You can use that if you want Link Here. Fingers are crossed that someone will take an initiative and built one. You can go through the presentation of ichikaway at cakefest and get an insight for the cakePHP 2 plugin for mongodb Video Link

Edit-1: New plugin developed by lewestopher please feel free to checkout the url for further information cakephp-monga. I haven't used it yet but it's worth a try, Nice initiation. Edit-2: Just an update that another datasource is also available by tiaguinho mongodb-cakephp3

like image 79
valar morghulis Avatar answered Mar 23 '23 01:03

valar morghulis