I got a simple WS that acts like a session server, nothing complex at all. When I create a session, I got an _id from Mongo that I cannot give back to user cause of the sequence used by mongo.
Example of ids sequence when chaining the creation:
536004fe2e1d59c95e9155a8
536004fe2e1d59c95e9155a9
536004fe2e1d59c95e9155aa
536004fe2e1d59c95e9155ab
As u can see, can ask a session and try to figure out next ones...
My question is: what sort of tricks do you use to create random but (nearly) unique id?
- sha1/md5/... of the mongo _id, stored on the db. Implication is save + update
- Using one-way encryption on the fly on the _id
- Do not use a session db... Hey ! I have no choice !!
- ... ?