I have my collection student :
"_id" : 1,
"marks" : [
{
"name" : "maths",
"score" : 78
},
{
"name" : "physics",
"score" : 88
}
]
I can $push marks in the shell:
db.student.update({_id:1},{$push:{marks:{type:"english", score:99}}})
I want to write this inside the StudentRepository:MongoRepository as a custom query :
@Repository
public interface StudentRepository extends MongoRepository<Student,Long> {
@Query()//how to write this ??
public void append(Long studentId, Mark mark);
}