1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

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 <leibale1998@gmail.com>
This commit is contained in:
Jay Koontz
2022-10-25 06:20:55 -05:00
committed by GitHub
parent 64e982d2bf
commit 4cfad3dab2

View File

@@ -1 +1,35 @@
# @redis/graph
Example usage:
```javascript
import { createClient } from 'redis';
const client = createClient();
client.on('error', (err) => console.log('Redis Client Error', err));
await client.connect();
await client.graph.query(
'graph',
"CREATE (:Rider { name: 'Buzz Aldrin' })-[:rides]->(:Team { name: 'Apollo' })"
);
const result = await client.graph.query(
'graph',
`MATCH (r:Rider)-[:rides]->(t:Team) WHERE t.name = 'Apollo' RETURN r.name, t.name`
);
console.log(result);
```
Output from console log:
```json
{
headers: [ 'r.name', 't.name' ],
data: [ [ 'Buzz Aldrin', 'Apollo' ] ],
metadata: [
'Cached execution: 0',
'Query internal execution time: 0.431700 milliseconds'
]
}
```