title: How to save and query dynamic fields in Spring Data MongoDB?
body: <p>I'm on Spring boot 1.4.x branch and Spring Data MongoDB.</p>
  
  <p>I want to extend a Pojo from <code>HashMap</code> to give it the possibility to save new properties dynamically. </p>
  
  <p>I know I can create a <code>Map&lt;String, Object&gt;</code> properties in the Entry class to save inside it my dynamics values but I don't want to have an inner structure. My goal is to have all fields at the root's entry class to serialize it like that:</p>
  
  <pre><code>{
     "id":"12334234234",
     "dynamicField1": "dynamicValue1",
     "dynamicField2": "dynamicValue2"
  }
  </code></pre>
  
  <p>So I created this Entry class:</p>
  
  <pre><code>@Document
  public class Entry extends HashMap&lt;String, Object&gt; {
  
      @Id
      private String id;
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  }
  </code></pre>
  
  <p>And the repository like this:</p>
  
  <pre><code>public interface EntryRepository extends MongoRepository&lt;Entry, String&gt; {
  }
  </code></pre>
  
  <p>When I launch my app I have this error:</p>
  
  <pre><code>Error creating bean with name 'entryRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.model.MappingException: Could not lookup mapping metadata for domain class java.util.HashMap!
  </code></pre>
  
  <p>Any idea?</p>