1
0
Fork 0
arangodb/Documentation/Books/Drivers/JS/Reference/Graph
Simran fd1019c51e Doc - Sync external repos 2018-09-26 (#6476) 2018-10-01 18:12:56 +02:00
..
EdgeCollection.md Doc - Sync external repos 2018-09-26 (#6476) 2018-10-01 18:12:56 +02:00
Edges.md Doc - Sync external repos 2018-09-26 (#6476) 2018-10-01 18:12:56 +02:00
README.md Doc - Sync external repos 2018-09-26 (#6476) 2018-10-01 18:12:56 +02:00
VertexCollection.md Doc - Sync external repos 2018-09-26 (#6476) 2018-10-01 18:12:56 +02:00
Vertices.md Doc - Sync external repos 2018-09-26 (#6476) 2018-10-01 18:12:56 +02:00

README.md

Graph API

These functions implement the HTTP API for manipulating graphs.

graph.exists

async graph.exists(): boolean

Checks whether the graph exists.

Examples

const db = new Database();
const graph = db.graph('some-graph');
const result = await graph.exists();
// result indicates whether the graph exists

graph.get

async graph.get(): Object

Retrieves general information about the graph.

Examples

const db = new Database();
const graph = db.graph('some-graph');
const data = await graph.get();
// data contains general information about the graph

graph.create

async graph.create(properties): Object

Creates a graph with the given properties for this graph's name, then returns the server response.

Arguments

Examples

const db = new Database();
const graph = db.graph('some-graph');
const info = await graph.create({
  edgeDefinitions: [{
    collection: 'edges',
    from: ['start-vertices'],
    to: ['end-vertices']
  }]
});
// graph now exists

graph.drop

async graph.drop([dropCollections]): Object

Deletes the graph from the database.

Arguments

  • dropCollections: boolean (optional)

    If set to true, the collections associated with the graph will also be deleted.

Examples

const db = new Database();
const graph = db.graph('some-graph');
await graph.drop();
// the graph "some-graph" no longer exists