How can I change a field that is many levels down from the source type with merge()?

#1

For
foo.make({
id: “test”,
BB: {CC: “one”}
}).create()

What is the correct to change the “one” to something else?

foo.merge({id: “test”, BB.CC: “XX”}) ?

0 Likes

#2

It would be same as make:

foo.merge({id: “test”, BB: {CC: “XX”}})

0 Likes

#3

What if the type is

foo.make({
id: “test”,
BB: {CC: “one”, DD: “one”, EE:“one”}
}).create()

Do I have to include CC, DD, EE when I just want to change CC?
foo.merge({id: “test”, BB: {CC: “XX”, DD: “one”, EE:“one”}})

0 Likes

#4

Based on my experience, yes, you have to include everything again. Otherwise you end up with just CC.

0 Likes