我刚开始使用MongoDB。我可以插入在终端新记录与像蒙戈命令:MongoDb插入错误(php) - BSON doc是X字节,最大为0
db.test.insert({var: 'data' }) .
,我可以用PHP获得这些记录,如:
Array
(
[0] => Array
(
[_id] => MongoId Object
(
[$id] => 509d0a4ae6c4d3ca0ba30572
)
[deneme] => 1
)
[1] => Array
(
[_id] => MongoId Object
(
[$id] => 509d09e2a3047c588723f9bf
)
[deneme] =>
[name] => aa
)
)
但我不能像PHP插入记录:
$m->insert(array(
'url' => 'http://www.query7.com',
'software' => 'wordpress',
'tutorials' => array('php','javascript','web development'),
));
我得到这个错误: 致命错误:未捕获异常'MongoException'消息'BSON文档的大小为145字节,最大为0'
我已经测试过不同的php类,但我总是得到相同的错误。什么是“BSON doc的大小”?
谢谢
你插入之前,选择一个数据库,并收集后消失? – Petrogad
yes, $ m-> setDatabase(“test”); \t $ m-> setCollection(“test”); \t \t \t $间 - >刀片(阵列( \t 'URL'=> 'http://www.query7.com', \t '软件'=> '的wordpress', \t '教程'= > array('php','javascript','web development'), \t)); – Musher
您正在尝试保存大于MongoDB可保存的文档。 – GBD