Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 962 Bytes

File metadata and controls

36 lines (30 loc) · 962 Bytes
description
How-to add documents to TerminusDB and TerminusCMS using the JavaScript Client

Add Documents

After you have imported the terminusdb_client, and created a client, connected to a database, and added some 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)
}