Call Mongodb stored function from PHP7

前端 未结 1 1171
我寻月下人不归
我寻月下人不归 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:37

    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)
提交回复
热议问题