title: MongoDB custom and unique IDs
body: <p>I'm using MongoDB, and I would like to generate unique and cryptical IDs for blog posts (that will be used in restful URLS) such as <em>s52ruf6wst</em> or <em>xR2ru286zjI</em>.</p>
  
  <p>What do you think is best and the more scalable way to generate these IDs ?</p>
  
  <p>I was thinking of following architecture :</p>
  
  <ul>
  <li>a periodic (daily?) batch running to generate a lot of random and uniques IDs and insert them in a dedicated MongoDB collection with InsertIfNotPresent</li>
  <li>and each time I want to generate a new blog post, I take an ID from this collection and mark it as "taken" with UpdateIfCurrent atomic operation</li>
  </ul>
  
  <p>WDYT ?</p>