Php codeigniter 3.x中的MongoDB\Driver\Exception\InvalidArgumentException
将CI 2.x中的项目迁移到3.x后,在我使用mongo db的地方显示了以下错误,这在codeigniter版本2中运行良好 消息:无法分析MongoDB URI:“MongoDB://”。无效主机 URI中的字符串 数据库配置Php codeigniter 3.x中的MongoDB\Driver\Exception\InvalidArgumentException,php,mongodb,codeigniter-3,Php,Mongodb,Codeigniter 3,将CI 2.x中的项目迁移到3.x后,在我使用mongo db的地方显示了以下错误,这在codeigniter版本2中运行良好 消息:无法分析MongoDB URI:“MongoDB://”。无效主机 URI中的字符串 数据库配置 // Generally will be localhost if you're querying from the machine that Mongo is installed on $config['mongo_host'] = "localhost"; //$
// Generally will be localhost if you're querying from the machine that Mongo is installed on
$config['mongo_host'] = "localhost";
//$config['mongo_host'] = "xxxxxxxxx.compute.amazonaws.com";
// Generally will be 27017 unless you've configured Mongo otherwise
$config['mongo_port'] = 27017;
// The database you want to work from (required)
$config['mongo_db'] = "test_p1";
// Leave blank if Mongo is not running in auth mode
$config['mongo_user'] = "";
$config['mongo_pass'] = "";
// Persistant connections
$config['mongo_persist'] = TRUE;
$config['mongo_persist_key'] = 'ci_mongo_persist';
// Get results as an object instead of an array
$config['mongo_return'] = 'array'; // Set to object
// When you run an insert/update/delete how sure do you want to be that the database has received the query?
// safe = the database has receieved and executed the query
// fysnc = as above + the change has been committed to harddisk <- NOTE: will introduce a performance penalty
$config['mongo_query_safety'] = 'safe';
// Supress connection error password display
$config['mongo_supress_connect_error'] = TRUE;
// If you are having problems connecting try changing this to TRUE
$config['host_db_flag'] = FALSE;
//如果您从安装Mongo的机器上进行查询,则通常为localhost
$config['mongo_host']=“localhost”;
//$config['mongo_host']=“xxxxxxxxx.compute.amazonaws.com”;
//通常为27017,除非您配置了Mongo
$config['mongo_port']=27017;
//要从中工作的数据库(必需)
$config['mongo_db']=“test_p1”;
//如果Mongo未在身份验证模式下运行,则保留为空
$config['mongo_user']=“”;
$config['mongo_pass']=“”;
//持久连接
$config['mongo_persist']=TRUE;
$config['mongo_persist_key']='ci_mongo_persist';
//将结果作为对象而不是数组获取
$config['mongo_return']='array';//设为对象
//运行insert/update/delete时,您希望如何确定数据库已收到查询?
//safe=数据库已接收并执行查询
//fysnc=如上所述+更改已提交到硬盘您可能忘记在本地计算机中设置数据库。i'hv更新了数据库配置@好吧,让我试试,。谢谢