Mvc\Collection::findById

public static findById (mixed $id)

Find a document by its id (_id)

// Find user by using \MongoId object
 $user = Users::findById(new \MongoId('545eb081631d16153a293a66'));

 // Find user by using id as sting
 $user = Users::findById('45cbc4a0e4123f6920000002');

 // Validate input
 if ($user = Users::findById($_POST['id'])) {
     // ...
 }
doc_Phalcon
2016-10-16 09:52:12
Comments
Leave a Comment

Please login to continue.