php - Does MongoDB::execute uses mongos eval() internally?

21

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') 
    ))
);
190

Answer

Solution:

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. ;)

People are also looking for solutions to the problem: php - More link always open the first one

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.