ArangoDB v3.4 reached End of Life (EOL) and is no longer supported.
This documentation is outdated. Please see the most recent version here: Latest Docs
View API
These functions implement the HTTP API for manipulating views.
view.exists
async view.exists(): boolean
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Checks whether the view exists.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
const result = await view.exists();
// result indicates whether the view exists
view.get
async view.get(): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Retrieves general information about the view.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
const data = await view.get();
// data contains general information about the view
view.properties
async view.properties(): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Retrieves the view’s properties.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
const data = await view.properties();
// data contains the view's properties
view.create
async view.create([properties]): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Creates a view with the given properties for this view’s name, then returns the server response.
Arguments
-
properties:
Object
(optional)For more information on the properties object, see the HTTP API documentation for creating views.
Examples
const db = new Database();
const view = db.arangoSearchView("potatoes");
await view.create();
// the arangosearch view "potatoes" now exists
view.setProperties
async view.setProperties(properties): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Updates the properties of the view.
Arguments
-
properties:
Object
For information on the properties argument see the HTTP API for modifying views.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
const result = await view.setProperties({ consolidationIntervalMsec: 123 });
assert.equal(result.consolidationIntervalMsec, 123);
view.replaceProperties
async view.replaceProperties(properties): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Replaces the properties of the view.
Arguments
-
properties:
Object
For information on the properties argument see the HTTP API for modifying views.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
const result = await view.replaceProperties({ consolidationIntervalMsec: 234 });
assert.equal(result.consolidationIntervalMsec, 234);
view.rename
async view.rename(name): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Renames the view. The View instance will automatically update its name when the rename succeeds.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
const result = await view.rename("new-view-name");
assert.equal(result.name, "new-view-name");
assert.equal(view.name, result.name);
// result contains additional information about the view
view.drop
async view.drop(): Object
This method is only available when targeting ArangoDB 3.4 or later, see Compatibility.
Deletes the view from the database.
Examples
const db = new Database();
const view = db.arangoSearchView("some-view");
await view.drop();
// the view "some-view" no longer exists