Database functions

db.nameFromElementId()

Details

Syntax

db.nameFromElementId(elementId)

Description

Resolves the database name for the given element id.

Arguments

Name

Type

Description

elementId

STRING

An element id of a node or relationship.

Returns

STRING

Considerations

The name of the database can only be returned if the provided element id belongs to a standard database in the DBMS.

The function only returns the name of the database if one or more of the following are true:

  • the user has access to the database

  • the database is a standard database and the user has DATABASE MANAGEMENT, CREATE DATABASE, DROP DATABASE, ALTER DATABASE or SET DATABASE ACCESS privileges

  • the database is a composite database and the user has COMPOSITE DATABASE MANAGEMENT, CREATE COMPOSITE DATABASE, DROP COMPOSITE DATABASE or ALTER COMPOSITE DATABASE privileges

Example 1. db.nameFromElementId()
Query
WITH "2:efc7577d-022a-107c-a736-dbcdfc189c03:0" AS eid
RETURN db.nameFromElementId(eid) AS name

Returns the name of the database which the element id belongs to.

Result
name

"neo4j"

Rows: 1