Calling a stored procedure via PHP in MongoDB

自古美人都是妖i 提交于 2019-12-06 07:14:20

Are you sure you're using the same database? Try simplifying it to a basic example, e.g.,

$m = new Mongo();
$db = $m->foo;

$db->system->js->save(array("_id"=>"archiveMessages", 
   "value"=>new MongoCode("function() { return 3; }")));

print_r($db->execute("archiveMessages()"));

Results in:

Array
(   
    [retval] => 3
    [ok] => 1
)

Check the documentation:

http://php.net/manual/en/mongodb.execute.php

Are you assigning the return value of execute() to a variable?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!