$ops = array(
array(
"$lookup" => array(
"from" => $reference_2,
"localField" => "_id",
"foreignField" => "field_4",
"as" => "dataref"
)
)
);
$results = $reference_1->aggregate($ops);
var_dump($results);
但有错误?
注意:未定义的变量:在第6行的D:\ xampp \ htdocs \ RISET \ Mongodb \ mongodb_reference.php中查找
致命错误:不允许使用带有“零长度密钥”消息的未捕获异常“MongoException”,您是否使用带双引号的$?在D:\ xampp \ htdocs \ RISET \ Mongodb \ mongodb_reference.php:16堆栈跟踪:#0 D:\ xampp \ htdocs \ RISET \ Mongodb \ mongodb_reference.php(16):MongoCollection-> aggregate(Array)#1在第16行的D:\ xampp \ htdocs \ RISET \ Mongodb \ mongodb_reference.php中抛出{main}
我该怎么办?我使用mongodb 3.2.12