php - Uncaught exception 'MongoException' with message 'Invalid object ID' -


i had php code working nicely, after updated mongo (2.4.4) , mongo driver php (1.4.2), code started generate fatal error.

the line generates error one

$something = new mongoid($some); 

it generates error:

fatal error: uncaught exception 'mongoexception' message 'invalid object id' 

surely, can roll updates, there idea how can fix without rolling back?

most error because of wrong $some providing. have pass correct mongoid new mongoid() constructor.

so new mongoid('51e1eefc065f908c10000411') ok, new mongoid('-6') generate error.

i using try catch handle this.

try {     $something = new mongoid($some); } catch (mongoexception $ex) {     $something = new mongoid(); } 

so think this documentation little bit outdated , should changed.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -