I created a Stored JS function which supposedly completes a very tedious job, faster and efficiently. Now after a investing long working hours I came up with completing this functionality.
So my function is suppose myFunc();
db.system.js.save(
{
_id : "myFunc" ,
value : function (param1,param2,param3....){ ... }});
Once I was through with completing this function, and testing it with Mongo Shell as
db.eval("myFunc('a','b'...)");
and
db.loadServerScripts();
myFunc('a','b',..);
I was satisfied it will work, Now the problem begins, How to achieve this with PHP?
$cmd = 'db.eval("myFunc(\'a\',\'b\'...);");';
$data = $mongo_db->execute($cmd);
var_dump($data);
$data comes up with nothing..!!
array(2) { ["retval"]=> NULL ["ok"]=> float(1) }
Somebody tell me please what the heck am I doing wrong..!!