Star

Created With
You are viewing the documentation for Neogma v1. This version is in maintenance mode, and you can upgrade to v2 following the migration guide. For the latest features and improvements, see the Neogma v2 documentation.

linkHelpers

The QueryRunner class also provides some helpers for custom Cypher queries.

linkGetting the properties from a QueryResult

The properties of nodes can be easily fetched

1linkconst queryResult = await queryRunner.run(

2link `MATCH (n:User {id: $id}) RETURN n`,

3link { id: 1 },

4link);

5link

6link/* --> get the properties of the node with the alias 'n' */

7linkconst properties = QueryRunner.getResultProperties(queryResult, 'n');

8linkconsole.log(properties[0].id); // 1

linkGetting how many nodes where deleted, from a QueryResult

1linkconst res = await queryRunner.delete({

2link where: {

3link name: 'John'

4link },

5link});

6link

7linkconst nodesDeleted = QueryRunner.getNodesDeleted(res);

8linkconsole.log(nodesDeleted); // 5

linkDefault QueryRunner identifiers

QueryRunner exposes the default identifiers which are used in the queries.

1link/* --> general purpose default identifier */

2linkconsole.log(QueryRunner.identifiers.default);

3link/* --> default identifiers for createRelationship */

4linkconsole.log(QueryRunner.createRelationship);

5link/* default identifier for the source node */

6linkconsole.log(QueryRunner.createRelationship.source);

7link/* default identifier for the target node */

8linkconsole.log(QueryRunner.createRelationship.target);

HelpersGetting the properties from a QueryResultGetting how many nodes where deleted, from a QueryResultDefault QueryRunner identifiers

Introduction Getting Started

Modelschevron_right

Sessions and Transactions

Query Builderchevron_right
Query Runnerchevron_right

Bind Parameters

Where Parameters