Skip to content

Commit 7d80995

Browse files
committed
add example to README
1 parent 5f1a8c5 commit 7d80995

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@
1010
# Example: Using the JavaScript Client
1111

1212
```javascript
13-
13+
let graph = new RedisGraph('social');
14+
graph
15+
.query("CREATE (:person{name:'roi',age:32})")
16+
.then( () => {
17+
return graph.query("CREATE (:person{name:'amit',age:30})");
18+
})
19+
.then( () => {
20+
return graph.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[knows]->(a)")
21+
})
22+
.then( () => {
23+
return graph.query("MATCH (a:person)-[knows]->(:person) RETURN a")
24+
})
25+
.then( (res) => {
26+
while(res.hasNext()){
27+
let record = res.next();
28+
console.log(record.getString('a.name'));
29+
}
30+
console.log(res.getStatistics().queryExecutionTime());
31+
});
1432

1533
```

0 commit comments

Comments
 (0)