我正在尝试将查询存储在mongodb的存储javascript中,如下所示:
$query = $collection->count(array( 'email' => "me@hotmail.com", 'app_id' => $app_id ));
$db->system->js->save(array(
"_id" => "archiveMessages2",
"value" => new MongoCode("function() { $query }")
));
然后我尝试通过执行如下函数来运行查询:print_r($db->execute("archiveMessages2()"));
但它什么也不回。
请帮助
现在得到了,只需要添加像一样的"return"
"value" => new MongoCode("function() { return $query }")