It’s a bummer that I can no-longer edit my previous post to highlight what I did wrong
@Daniel_Steigerwald I did see your original post. I asked about the rest of the structure of the data to make sure you and I were really looking at the same the data, and to understand the complexity of that data… I will make some assumptions.
I definitely messed up my understanding of
Merge. To anyone and everyone that I suggested that
Merge work like
Object.assign, I apologize. It’s actually like lodash
Remember that there is the
Replace function, in addition to
Ok. That means you still have some options, but will need to compare the complexity with what you are already doing. I am assuming that the document is much more complex, but don’t know without sharing more. The new example should get the point across though.
new option A: if by chance
state is the only field under
data then there is no added value to the extra object – Everything under
state can be directly under
data. Document with
state wrapper and another without it would be isomorphic. You can use
Replace every time instead of
Update. My guess is not so easy! Just putting it out there, though!
new option B: You can use
Replace and reconstruct the rest of the document with
Select. This might be okay if there is only one, maybe two fields other than
state, but it would get out of hand quickly.
ref: Ref(Collection('Test'), '268352561226973696'),
field1: Select(['data', 'field1'], Var('instance')),
field2: Select(['data', 'field2'], Var('instance')),
new Option C: I’m out of ideas.
new Option D: Wait for Fauna to implement
Assign function, to complement
Merge? I’m out of good ideas anyway.
Or just keep on keepin’ on how you’re doing. Only functional difference is
[1 Read + 1 Write] vs
[2 Write] operations.