title: Looking up submissions by ID with MongoDB/Mongoose
body: <p>So I'm used to looking up submissions by an auto increment primary ID with MySQL, but after using the MongoDB ORM wrapper, Mongoose, I'm finding that since Mongo stores data within collections differently, there is not really any concept of a traditional auto-increment ID.</p>
  
  <p>I'm stuck trying to figure out how to grab a submission now because normally I'd structure my URL like so:</p>
  
  <p><code>submission/34/category/slug-goes-here</code>.</p>
  
  <p>Since the <code>34</code> now becomes an ugly string based UUID with Mongo, I don't necessary want to display that in my URLs, but I want a unique URL in order to look up my submissions.</p>
  
  <p>I'm thinking of maybe having a set method that when I insert the submission into my database, it generates some kind of 6 character hash e.g. <code>zhXk40</code> and looks it up like that.</p>
  
  <p>I'm wondering if I do it like this what the performance trade-offs would be. If I made constraints on the slug and then looked them up with the slug, and verified that the category matched, would that be more efficient? Either way I'm going to have to check if the category and slug match, but I'm not sure if an ID is even really necessary in this case.</p>
  
  <p>What's the best practice for creating a route + looking up some piece of data from the db based on that route?</p>