Skip to content

Commit 4cfad3d

Browse files
jkoontz2010leibale
andauthored
Update RedisGraph README.md (#2239)
* Update README.md Simple example using Cypher to CREATE a graph with relationships and then MATCH on that graph * Update README.md Co-authored-by: Leibale Eidelman <[email protected]>
1 parent 64e982d commit 4cfad3d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

packages/graph/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
11
# @redis/graph
2+
3+
Example usage:
4+
```javascript
5+
import { createClient } from 'redis';
6+
7+
const client = createClient();
8+
client.on('error', (err) => console.log('Redis Client Error', err));
9+
10+
await client.connect();
11+
12+
await client.graph.query(
13+
'graph',
14+
"CREATE (:Rider { name: 'Buzz Aldrin' })-[:rides]->(:Team { name: 'Apollo' })"
15+
);
16+
17+
const result = await client.graph.query(
18+
'graph',
19+
`MATCH (r:Rider)-[:rides]->(t:Team) WHERE t.name = 'Apollo' RETURN r.name, t.name`
20+
);
21+
22+
console.log(result);
23+
```
24+
25+
Output from console log:
26+
```json
27+
{
28+
headers: [ 'r.name', 't.name' ],
29+
data: [ [ 'Buzz Aldrin', 'Apollo' ] ],
30+
metadata: [
31+
'Cached execution: 0',
32+
'Query internal execution time: 0.431700 milliseconds'
33+
]
34+
}
35+
```

0 commit comments

Comments
 (0)