I need to insert a new track into the existing event document following is my class structure
class Event
{
String _id;
List<Track> tracks;
}
class Track
{
String _id;
String title;
}
My existing document is
{
"_id":"1000",
"event_name":"Some Name"
}
document will look like after insertion
{
"_id":"1000",
"event_name":"Some name",
"tracks":
[
{
"title":"Test titile",
}
]
}
How can i insert that track into my existing document using mongoTemplate spring data mongodb?