title: How to create a unique slug in waterlines beforeValidate callback?
body: <p>The problem: I am using Waterline as my ORM with OrientDB in a NodeJS app. OrientDB uses numeric IDs, so I don't want them in my URLs when getting a post. Why? Because it would make it easy to query the complete data by just incrementing the ID. </p>
  
  <p>The solution: Creating a unique slug.</p>
  
  <p>Question: How can this be achieved in Waterline with async callbacks? I need something like this but fail to come up with a solution. The flow is probably like this:</p>
  
  <ul>
  <li>Create slug</li>
  <li>Check if post with slug exists</li>
  <li>If no, continue with validation</li>
  <li>If yes, change slug and start over</li>
  </ul>