neo4j-driver 5.14.0 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/examples/node.js CHANGED
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Copyright (c) "Neo4j"
3
- * Neo4j Sweden AB [http://neo4j.com]
4
- *
5
- * This file is part of Neo4j.
3
+ * Neo4j Sweden AB [https://neo4j.com]
6
4
  *
7
5
  * Licensed under the Apache License, Version 2.0 (the "License");
8
6
  * you may not use this file except in compliance with the License.
@@ -17,36 +15,36 @@
17
15
  * limitations under the License.
18
16
  */
19
17
 
20
- var neo4j = require('neo4j')
18
+ const neo4j = require('neo4j')
21
19
 
22
- var query = [
20
+ const query = [
23
21
  'MERGE (alice:Person {name:$name_a}) ON CREATE SET alice.age = $age_a',
24
22
  'MERGE (bob:Person {name:$name_b}) ON CREATE SET bob.age = $age_b',
25
23
  'MERGE (alice)-[alice_knows_bob:KNOWS]->(bob)',
26
24
  'RETURN alice, bob, alice_knows_bob'
27
25
  ]
28
26
 
29
- var params = {
27
+ const params = {
30
28
  name_a: 'Alice',
31
29
  age_a: 33,
32
30
  name_b: 'Bob',
33
31
  age_b: 44
34
32
  }
35
33
 
36
- var driver = neo4j.driver('bolt://localhost')
34
+ const driver = neo4j.driver('bolt://localhost')
37
35
 
38
- var streamSession = driver.session()
39
- var streamResult = streamSession.run(query.join(' '), params)
36
+ const streamSession = driver.session()
37
+ const streamResult = streamSession.run(query.join(' '), params)
40
38
  streamResult.subscribe({
41
39
  onNext: function (record) {
42
40
  // On receipt of RECORD
43
- for (var i in record) {
41
+ for (const i in record) {
44
42
  console.log(i)
45
43
  console.log(record[i])
46
44
  }
47
45
  },
48
46
  onCompleted: function () {
49
- var summary = streamResult.summarize()
47
+ const summary = streamResult.summarize()
50
48
  // Print number of nodes created
51
49
  console.log('')
52
50
  console.log(summary.updateStatistics.nodesCreated())
@@ -57,17 +55,17 @@ streamResult.subscribe({
57
55
  }
58
56
  })
59
57
 
60
- var promiseSession = driver.session()
61
- var promiseResult = promiseSession.run(query.join(' '), params)
58
+ const promiseSession = driver.session()
59
+ const promiseResult = promiseSession.run(query.join(' '), params)
62
60
  promiseResult
63
61
  .then(function (records) {
64
62
  records.forEach(function (record) {
65
- for (var i in record) {
63
+ for (const i in record) {
66
64
  console.log(i)
67
65
  console.log(record[i])
68
66
  }
69
67
  })
70
- var summary = promiseResult.summarize()
68
+ const summary = promiseResult.summarize()
71
69
  // Print number of nodes created
72
70
  console.log('')
73
71
  console.log(summary.updateStatistics.nodesCreated())