Travis Brown
Travis Brown

Reputation: 11

I can't configure CakePHP 2.1.0 with MongoDB Datasource Plugin

I have gotten the latest CakePHP (2.1.0) and MongoDB Datasource Plugin both from git, and have followed the configuration settings as best as I can. I have placed the MonogoDB plugin in the plugins directory, and updated both my database.php and bootstrap.php files:

bootstrap.php:

CakePlugin::load('Mongodb');

database.php:

class DATABASE_CONFIG {

  public $default = array(
  'datasource' => 'Mongodb.MongodbSource',
      'database' => 'database',
      'host' => 'staff.mongohq.com',
      'port' => 10070,
      'login' => 'user', 
      'password' => 'secret'
  );  

}

I'm afraid I'm missing something stupid, but I keep getting the error:

Datasource class MongodbSource could not be found.

Which to me, implies it can find the plugin, but not the datasource class. Anyone seen this before? I've also tried to connect to a locally installed MongoDB, but same error persists.

Upvotes: 1

Views: 2161

Answers (2)

Chatura Dilan
Chatura Dilan

Reputation: 1572

Please make sure that you are using the CakePHP-Mongo plugin for CakePHP 2.0 and not CakePHP 1.3

Upvotes: 0

Michael Marr
Michael Marr

Reputation: 2099

Use this command to pull the plugin so it pulls the cake2.0 branch instead (which uses the correct cake 2.x directory naming conventions):

git clone -b cake2.0 git://github.com/ichikaway/cakephp-mongodb.git Mongodb

Upvotes: 4

Related Questions