I have a weird behavior here with Spring Boot MongoDb. This document:
@Document(collection = "schedules")
data class ScheduleDocument(val payload: Payload) {
}
is stored as:
{
"_id" : ObjectId("5a636f2e5017622fc0c4654a"),
"_class" : "example.Payload",
"channel" : "push",
"schedule" : ISODate("2018-01-20T16:32:46.535Z")
}
But I was expecting
payload
to be a subdocument, like this:
{
"_id" : ObjectId("5a636f2e5017622fc0c4654a"),
"_class" : "example.ScheduleDocument",
"payload": {
"channel" : "push",
"schedule" : ISODate("2018-01-20T16:32:46.535Z")
}
}
can anyone explain this behavior?