Reputation: 1291
I'm trying to get mongodb to work with cakephp. I'm not sure on where to place ichikaway's mongodb driver for cakephp and where to add the database connection.
My directory structure is that, under c:/websites/
, I have cakephp
folder and my project merry_flowers
folder.
i've already gone through ichikaway's github and mark story's website.
If I put the mongodb driver in \cakephp\app\plugins and database connection in \cakephp\app\config\database.php I'm getting the following error:
fatal error 256: ConnectionManager::loadDataSource - Unable to import DataSource class mongodb.mongodbSource [CORE\cake\libs\model\connection_manager.php, line 185]Code | Context
if (!App::import('Datasource', $class, !is_null($conn['plugin']))) {
trigger_error(sprintf(__('ConnectionManager::loadDataSource - Unable to import DataSource class %s', true), $class), E_USER_ERROR);$connName = "mongo"
$_this = ConnectionManager
ConnectionManager::$config = DATABASE_CONFIG object
ConnectionManager::$_dataSources = array
ConnectionManager::$_connectionsEnum = array
$conn = array(
"plugin" => "mongodb",
"classname" => "mongodbSource",
"parent" => array(
"filename" => "dbo_source",
"classname" => "DboSource",
"parent" => null,
"plugin" => null
),
"filename" => "dbo\mongodb_source"
)
$class = "mongodb.mongodbSource"ConnectionManager::loadDataSource() - CORE\cake\libs\model\connection_manager.php, line 185
ConnectionManager::getDataSource() - CORE\cake\libs\model\connection_manager.php, line 109
Model::setDataSource() - CORE\cake\libs\model\model.php, line 2836
Model::__construct() - CORE\cake\libs\model\model.php, line 469
ClassRegistry::init() - CORE\cake\libs\class_registry.php, line 142
Controller::loadModel() - CORE\cake\libs\controller\controller.php, line 637
Controller::constructClasses() - CORE\cake\libs\controller\controller.php, line 493
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 186
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 87
If I put the mongodb driver in \merry_flowers\plugins and add the database connection to \merry_flowers\config\database.php, I'm getting the following error:
connecting to localhost:27017 failed: Unknown error APP\plugins\mongodb\models\datasources\mongodb_source.php, line 201
thank you.
Upvotes: 0
Views: 1147
Reputation: 1589
It doesn't matter which plugins folder you use. Both have the same functionality. Both are included for your organizational convenience.
Do you have a mysql database set up also? If so, there might not be documentation for a dual installation. If you only have one DB, you should be configuring it in cakephp/app/config/database.php
Upvotes: 2