Call Mongodb stored function from PHP7

前端 未结 1 1356
长情又很酷
长情又很酷 2021-02-10 16:08

Below is my mongodb function that is stored in Mongodb.

db.system.js.save( { _id: \"echoFunction\", value : function(x) { return x; } }

相关标签:
1条回答
  • 2021-02-10 16:29

    You can use following code snippet from laravel to execute your mongoDB function.

    $cursor = DB::connection('mongodb')->command(array('eval' => 'echoFunction("4")')); $data = $cursor->toArray(); dd($data);

    Try and let me know if it works.

    0 讨论(0)
提交回复
热议问题