Edit a Document with the JavaScript Client

To update documents in your database, you first need to get the document you want to change. You then need to make your changes and update it. This example shows how -

const docs = {
    '@id'   : 'Player/George',
    '@type' : 'Player',
    name    : 'George',
    position: 'Center Back' 
  }

docs.position = "Full Back"

const updateDocs = async () => {
  const result = await client.updateDocument(docs);
  console.log("updated document", result)
}