title: unique index with doctrine mongodb odm
body: <p>i'm doing a registration system for my site and want to prevent duplicate registrations with the same email address.</p>
  
  <p>the declaration of the user class looks like this:</p>
  
  <pre><code>/**
   * @Document
   */
  class User extends BaseEntity
  {
      private 
      /**
       * @Id
       */
      $id,
  
      /**
       * @String @Index(unique=true)
       */    
      $email
  ;
  }
  </code></pre>
  
  <p>but whenever i save a user with the same email, no exception is raised and i get a duplicate.</p>
  
  <p>i found somewhere that i need to do $documentManager->flush(array('safe'=>true)); but that doesn't help.</p>
  
  <p>How can I achieve what i need? Thanks</p>