We have an object in dynamo DB with the key id and the data below in JSON format:
We are creating, getting, and updating this table through our frontend application using Amplify API connection to AppSync.
Currently, when we want to add items to our objects list, we overwrite the entire thing, but I know that it is possible to append new items to the existing data atomically.
My extra question is if append is supported, are other list operations supported for example splice and how do we implement it? Do we need to change the query on the client-side, or app syncs resolver / graphql schema?
Currently I am updating my data by overwriting with a fresh copy every time using this command on the client side:
import { API } from "aws-amplify"; import { ... updateTable, ... } from "../graphql/mutations"; API.graphql({ query: updateTable, variables: variables })
Here is the data structure in dynamo DB
{ "id": "something", "objects": [ [ { "foo": [ "first", "second" ], "start": 0, "end": 20 }, { "bar": [ "third", "fourth" ], "start":10, "end": 40 }, ] ], }