Is it possible to append a json object to a field of type: [Json]?
a
aurnik
06/15/2017, 7:45 PM
@mclovin Should be, what issues are you having?
m
mclovin
06/15/2017, 7:47 PM
I'm trying to accomplish this without using a nested mutation
To futher explain: i have a playlist with a field "tracks" of type [Json]. I try adding a track to the playlist without having any context about the playlist (only id an the track to ad)
And try this without using another schema object
a
agartha
06/15/2017, 9:34 PM
Create a function hook for Track for the update mutation, send in a mutation with id and the json field with only the new track. Then in the function, retrieve the existing Track by ID, append the new track to the retrieved value of the tracks field, and replace your context.data.tracks with the new list.
m
mclovin
06/15/2017, 9:41 PM
Thanks @agartha i'm going to try this!
a
agartha
06/15/2017, 9:43 PM
However, having tracks as a child type would be a lot easier...
Can I ask you why you don't want to use another schema object?