Describing a data structure that I am working with:
{
assignments: []
faqs_url: "oi"
id: "pW68CiGZJMZJzyY1GExz"
name: "oi"
notes: {
file: {
extension: "pdf",
type: "base64"
}
name: "o"
url: "http://192.168.1.111:3000/notes/o.pdf"
paper: "P1"
past_topicals: []
video_lectures: []
}
When updating this object using set(obj, {merge: true});
with the following updated object:
obj1 = {
assignments: []
faqs_url: "oi"
id: "pW68CiGZJMZJzyY1GExz"
name: "oi"
notes: {
name: "chnged name"
url: "http://192.168.1.111:3000/notes/o.pdf"
paper: "P1"
past_topicals: []
video_lectures: []
}
The result is that the notes
object gets replaced and the file
key is removed as it does not exist in the updated version.
My concern here is whether merge: true;
functions properly for nested objects?
Is there a way to achieve the desired merge behavior for nested objects?