Here is the scenario. I am storing entries in MongoDB and using the _id as a public identifier for each entry when fetching them to display. Since the _id is fairly hard to guess and therefore a user with access to one entry based on the _id in the url can not guess the next or previous entry (except for the example below) based on their information. I also do not have to create extra indexes on another field containing an md5 hash or uniqid for example.
The problem: When creating multiple entries as part of an import job, entries get very similar _id´s due to the fact that they are partly based on timestamp. Three entries created during an import can look like this as an example. 52014b1a3c9fb7733d000000 52014b1a3c9fb7733d000001 52014b1a3c9fb7733d000002
In this scenario, a user might see the pattern and try to edit the last part of each identifier, and succeed in viewing another entry in this case.
My question(s): Is it possible to control the MongoId generation upon document creation so that it does not use only the increment function at the end when creating large amount if entries as an import for example? Changing the device part of the id? Can that be done?
My last resort is to stop using the _id as the public identifier for the entries, forcing me to set up additional indexes on a very large collection. I hope I do not have to go there.
I am using MongoDb in a PHP based application.