title: Should I implement auto-incrementing in MongoDB?
body: <p>I'm making the switch to MongoDB from MySQL. A familiar architecture to me for a very basic <code>users</code> table would have auto-incrementing of the <code>uid</code>. <a href="http://www.mongodb.org/display/DOCS/Object+IDs#ObjectIDs-SequenceNumbers" rel="noreferrer">See Mongo's own documentation for this use case</a>.</p>
  
  <p>I'm wondering whether this is the best architectural decision. From a UX standpoint, I like having UIDs as external references, for example in shorter URLs: <code>http://example.com/users/12345</code></p>
  
  <p>Is there a third way? Someone in IRC Freenode's <code>#mongodb</code> suggested creating a range of IDs and caching them. I'm unsure of how to actually implement that, or whether there's another route I can go. I don't necessarily even need the <code>_id</code> itself to be incremented this way. As long as the <code>users</code> all have a unique numerical <code>uid</code> within the document, I would be happy.</p>