I have two mongodb collections . Student, Parent
Students have a reference parentId.
I am trying to fetch specific student as
Student.(query, update, {'fields': parentFieldsRequired , 'new': true},function(err,mData)
{
});
I also want to attach the parent object with specific fields to student object.
The end result would be something liek
username: abc,
fullName: abc,
password: abc,
image: abc,
backgroundImage: abc,
parent:{
fullName: abc,
image: abc
},
How can i update the findOneAndUpdate query to have achieve above response.