You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

create_relationship()

Usage

create_relationship(from, to, type)
create_relationship(from, to, type, key1, value1)
create_relationship(from, to, type, key1, value1, key2, value2, ...)

Structr.create_relationship(from, to, type, key1, value1, key2, value2);
Structr.create_relationship(from, to, type, {key1: value1, key2: value2});

Description
Creates a relationship of the given type between the two nodes. Please note that the inverse operation of this function is delete() since it can be used to delete both nodes and relationships. This method returns the created relationship.
In a JavaScript environment, the function can be used just as in a StructrScript environment. Alternatively it can take a dictionary as the fourth parameter.

Example

${create_relationship(me, group, 'HAS')}

Search results for "create_relationship()"

create_relationship()

Creates a relationship of the given type between the two nodes. Please note that the inverse operation of this function is delete() since it can be used to delete both nodes and relationships. This method returns the created relationship.

create_relationship(from, to, type [, key1, value1 [, ... ]] )
$.create_relationship(from, to, type [, map ]);