MongoDB configuration in CakePHP 3.x

5.8k views Asked by At

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,
    ]
] 
1

There are 1 answers

3
valar morghulis On BEST ANSWER

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