问题:当使用mongor
Laravel 的 bundle 时,我得到一个错误Class 'Mongo' not found
。任何想法出了什么问题?
我安装了 mongodb 并启动了 mongodb 服务。接下来我安装了mongor 包并创建/更新了以下文件。
php artisan bundle:install mongor
捆绑包.php
return array(
'docs' => array('handles' => 'docs'),
'mongor' => array('auto' => true),
);
数据库.php
'default' => 'mongor',
'mongor' => array(
'hostname' => 'localhost',
'connect' => true,
'timeout' => '',
'replicaSet' => '',
'db' => 'test',
'username' => '',
'password' => '',
),
用户.php
<?php
class User extends Mongor\Model {}
路由.php
Route::get('test', function() {
$user = User::find(1);
});
错误
Class 'Mongo' not found
Location: /var/www/test/bundles/mongor/mongodb.php on line 85
导致错误的行
$this->_connection = new \Mongo($conn, $options);