1
0
Fork 0
arangodb/Documentation/Books/Drivers/JS/Reference/Graph
maxkernbach e48030b37c Doc - sync external repositories (#7616) 2018-12-05 18:49:11 +01:00
..
EdgeCollection.md Doc - sync external repositories (#7616) 2018-12-05 18:49:11 +01:00
Edges.md Doc - sync 2018-10-02 (rename arangodbjs to arangojs) (#6680) 2018-10-02 16:31:18 +02:00
README.md Doc - sync 2018-10-02 (rename arangodbjs to arangojs) (#6680) 2018-10-02 16:31:18 +02:00
VertexCollection.md Doc - sync external repositories (#7616) 2018-12-05 18:49:11 +01:00
Vertices.md Doc - sync 2018-10-02 (rename arangodbjs to arangojs) (#6680) 2018-10-02 16:31:18 +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