I searched around and didn't see any good solution for partial update in GraphQL.
My goal was like call only 1 mutation method, and lets say that I got 15 fields that from the object. And I only want to update 3 out of 15. So I only pass in the those 3 fields with value, and I knew that rest will be pass in as null/defined.
I wonder that can I generate the name of the field base on the input?
Code Below
function partialUpdate(id, feild, data) { console.log("Triggered Partial update: " + data); Quest.findByIdAndUpdate(id, { $set: { feild: data } }, { new: true }).exec(); }
2.1m questions
2.1m answers
60 comments
57.0k users