How to use dynamic schema in spring data with mongodb?
<p>Mongodb is a no-schema document database, but in spring data, it's necessary to define entity class and repository class, like following:</p>

<p>Entity class:</p>

<pre><code>@Document(collection = "users")
public class User implements UserDetails {
    @Id private String userId;
    @NotNull @Indexed(unique = true) private String username;
    @NotNull private String password;
    @NotNull private String name;
    @NotNull private String email;
}
</code></pre>

<p>Repository class:</p>

<pre><code>public interface UserRepository extends MongoRepository&lt;User, String&gt; {
    User findByUsername(String username);
}
</code></pre>

<p>Is there anyway to use map not class in spring data mongodb so that the server can accept any dynamic JSON data then store it in BSON without any pre-class define?</p>