title: Spring mongodb template saves in the same object
body: <p>I have the model like following</p>
  
  <pre><code>@CompoundIndexes(value = {
          @CompoundIndex(name = "catalog_idx", def = "{'code' : 1, 'brand' : 1}", unique = true) })
  @Document(collection = Catalog.ENTITY)
  public class Catalog extends AbstractModel&lt;String&gt; {
  
      private static final long serialVersionUID = 1L;
  
      public static final String ENTITY = "catalog";
  
      @NotNull(message = "Code is required")
      @Field("code")
      private String code;
  
      @NotNull(message = "Brand is required")
      @DBRef(lazy = true)
      @Field("brand")
      private Brand brand;
  }
  </code></pre>
  
  <p>When i do save with <code>mongoTemplate.save(object);</code> i see only 2 objects created in DB instead of 6. Just before save my debug lines for objects to be saved.</p>
  
  <pre><code>Catalog [code=StagedCatalog, brand=Brand [code=Brand_3]]
  Catalog [code=StagedCatalog, brand=Brand [code=Brand_2]]
  Catalog [code=StagedCatalog, brand=Brand [code=Brand_1]]
  Catalog [code=OnlineCatalog, brand=Brand [code=Brand_2]]
  Catalog [code=OnlineCatalog, brand=Brand [code=Brand_1]]
  Catalog [code=OnlineCatalog, brand=Brand [code=Brand_3]]
  </code></pre>
  
  <p>Any ideas why ? I feel the Index unique thing is not working somehow. I want <code>code</code> and <code>brand</code> to be <code>unique combination</code>.</p>
  
  <pre><code>public abstract class AbstractModel&lt;ID extends Serializable&gt; implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      private ID id;
  }
  </code></pre>