2

PHP Mongo 驱动程序允许我在数据库中执行代码。这在分片环境中有效吗?我知道,使用 eval() 评估代码在分片环境中不起作用。

$db->execute(
    new MongoCode('SomeFunc(o)', array(
        'o' => array('name' => 'test') 
    ))
);
4

1 回答 1

0

In short: no.

Longer answer: MongoCode is used for sending JavaScript code to MongoDB in much the same way as if you entered it through Mongo shell. So it's MongoDB's responsibility to run the supplied code - it does not run inside the PHP engine.

UPDATE: I missed that part in your question about sharded environment which quite changes the short answer. ;)

于 2012-04-05T12:41:16.547 回答