Call Mongodb stored function from PHP7
问题 Below is my mongodb function that is stored in Mongodb. db.system.js.save( { _id: "echoFunction", value : function(x) { return x; } } ) I can call this function in mongo using below query : db.loadServerScripts(); echoFunction(3); Now i want to call this function from PHP 7. and also help with laravel. 回答1: You can use following code snippet from laravel to execute your mongoDB function. $cursor = DB::connection('mongodb')->command(array('eval' => 'echoFunction("4")')); $data = $cursor-