In my Spring boot project have a Document like so:
@Document(collection="AuditTable")
public class AuditTable {
@Id
private String id;
private Map<String, String> properties;
where properties is a dynamic field i.e. it can take in as many different key-value pairs.
I use MongoRepository to store this value:
@Repository
public interface AuditTableRepo extends MongoRepository<AuditTable, String> {
}
Now when I store it in the Collection it looks like this:
whereas I want it to look like this:
"_id": "XYZ"
"_class": "XYZ"
"workCaseId":"12"
"taskName":"AUDIT"
"owner":"ANSHU"
"createdDate":"XYZ"
Any idea about how I can fix this without using converters? Or if I do have to use them how should I do it?
I'm new to spring data mongodb as we have recently made the jump to mongo from Oracle.