I'm using mongodb with mongoose, and using normal mongodb objectids as my primary key. I like objectids but in URLs they're a bit long, and I'd like to use something shorter.
I've seen modules like shortid which generate shorter strings, but I'm not convinced of their uniqueness. I am convinced of the uniqueness of objectids and would like to find a way to just compress them down a bit. Then I found the module hashids, which is able to do just that. Now the question is: how do I best incorporate hashids into my models? Do I somehow override each model's id property so that it's automatically converted into a hashid right after reading from the database and converted back to an objectid right before saving? Or do I make a virtual field "myid" or something? How have others handled this? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
