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 +13 -15
- package/lib/browser/neo4j-web.esm.js +607 -579
- package/lib/browser/neo4j-web.esm.min.js +1 -1
- package/lib/browser/neo4j-web.js +607 -579
- package/lib/browser/neo4j-web.min.js +1 -1
- package/lib/docs.js +1 -3
- package/lib/driver.js +1 -3
- package/lib/index.js +1 -3
- package/lib/internal/retry-logic-rx.js +1 -3
- package/lib/internal/server-version.js +1 -3
- package/lib/result-rx.js +1 -3
- package/lib/session-rx.js +4 -3
- package/lib/transaction-managed-rx.js +1 -3
- package/lib/transaction-rx.js +1 -3
- package/lib/version.js +2 -4
- package/package.json +8 -7
- package/types/driver.d.ts +1 -3
- package/types/index.d.ts +1 -3
- package/types/query-runner.d.ts +1 -3
- package/types/result-rx.d.ts +1 -3
- package/types/session-rx.d.ts +1 -3
- package/types/transaction-managed-rx.d.ts +1 -3
- package/types/transaction-rx.d.ts +1 -3
package/examples/node.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) "Neo4j"
|
|
3
|
-
* Neo4j Sweden AB [
|
|
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
|
-
|
|
18
|
+
const neo4j = require('neo4j')
|
|
21
19
|
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
+
const driver = neo4j.driver('bolt://localhost')
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
61
|
-
|
|
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 (
|
|
63
|
+
for (const i in record) {
|
|
66
64
|
console.log(i)
|
|
67
65
|
console.log(record[i])
|
|
68
66
|
}
|
|
69
67
|
})
|
|
70
|
-
|
|
68
|
+
const summary = promiseResult.summarize()
|
|
71
69
|
// Print number of nodes created
|
|
72
70
|
console.log('')
|
|
73
71
|
console.log(summary.updateStatistics.nodesCreated())
|