Overview Defining a Model Instances Creating Nodes and Relationships Merging Nodes and Relationships Updating Nodes and Relationships Deleting Nodes Deleting Relationships Finding Nodes and Relationships Hooks Temporary Databases
A QueryRunner
instance can be used for creating nodes from Objects. The node properties and label are needed.
1link/* --> let 'queryRunner' be a QueryRunner instance */
2linkconst result = await queryRunner.create({
3link /* --> label(s) of the created nodes. Multiple labels like 'User:Person' can also be used */
4link label: 'User',
5link /* --> data (properties) for the nodes. Here, 2 nodes will be created */
6link data: [
7link {
8link phoneNumber: '1234567890',
9link codes: [0, 3, 8],
10link },
11link {
12link age: 38,
13link }
14link ],
15link /* --> (optional) the identifier of the nodes for the query. Is needed for parsing the results. Default is the value of 'QueryRunner.identifiers.default' */
16link identifier: 'u',
17link /* --> (optional) an existing session or transaction to use */
18link session: null,
19link});
20link
21link/* --> the result is the QueryResult from the neo4j driver */
22linkconsole.log(result.records.map((v) => v.get('u').properties));