Unique IDs with mongodb
问题 If I were building a blog I could use the blog title as the unique identifier and parse it through the URL. However, what if I wanted to use numbers. You know how twitter has www.twitter.com/username/statuses/9834542? Has anyone figured out a nice way of making this work? using "_id" is out of the question since it's way too long. 回答1: As long as you can guarantee uniqueness, you're not constrained to using the default "_id" MongoDB supplies. Therefore, it's down to you how you generate this