oscardelben/Mongo-Shortener — pull request #1 by mwenglein (2011-10-19 17:31:49+00:00)
Title: Base62 plus some extras to make shortening more efficient

Hi Oscar,

I need to so something similar and have added some ideas that made sense for my requirements:

I've played around with a different shortening algorithm based on Base62 which uses a-z, A-Z, 0-9 for a total of 62 different characters and thus further reduces the length of the shortened url.

Instead of random numbers for "seeding" I use an improvised auto increment (since mongo won't do it for you).

Identical urls get same shortened version, thus further reducing the overall table size.

Entering a non-existant short url now has its own n/a page.

Let me know if you want to take this any further :-)
mike