Add Documents

After you have imported the terminusdb_client, created a client, connected to a database, and added a schema, you can then use this client to insert a document that conforms to the schema.

Insert documents

Add documents to the schema using addDocument:

const objects = [
    {
        "@type" : "Player",
        name    : "George",
        position: "Center Back",
    },
    {
        "@type" : "Player",
        name    : "Doug",
        position: "Full Back",
    },
    { 
        "@type" : "Player", 
        name    : "Karen", 
        position: "Center Forward" 
    }
];

const addDocs = async () => {
  const result = await client.addDocument(objects);
  console.log("the documents have been added", result)
}