I have to import a lot of data into MongoDB from MySQL and I\'d like to use the timestamp from the ObjectID instead of storing it in a separate key/value (as it is in the ex
Right now, the PHP driver has no built in functionality for this, the __set_state() that the other answer mentioned is only for being able to session-deserialize the ID and doesn't allow you to create it through the specific components.
You will have to do the following to automatically create an ID: