Hi I’m making a web app using mongoDB for the persistence later, I was wondering how you could use the mongo ID automatically generated to point to a common row in a collection. For example we have a users collection (with an ‘_id’ field) and another collection to store the user’s API key information. How would it be possible to link these two so that the ‘_id’ in the API key collection corresponds to the user collection so that they point to the right user. This is being done in PHP 5.
Thanks in advance,
RayQuang
You can overwrite the default id with your own id.
So when you do an insert, you can set “_id” in your object, equivalent to the mongoid
present in your API key collection.
example code :
?>