Phalcon & mongodb - How to do findFirstBy syntax

Hi,

Can you please suggest me the syntax for Module::findFirstbyId ? in mongodo collection ?

Thanks, Raja K



3.6k

Hi,

I had found the solution.

use  \MongoId as MongoId;
$id =  new MongoId($input['id']);
$params = [ [ '_id' => $id ]];
$object = Department::findFirst($params);

Raja k