The PHP Mongo Driver allows me to execute code in the database.
Does this work in sharded environments? I know, that evaluating code with eval() doesn’t work in a sharded environment.
$db->execute(
new MongoCode('SomeFunc(o)', array(
'o' => array('name' => 'test')
))
);
In short: no.
Longer answer:
MongoCodeis 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. 😉