Skip to content

RedisGraph/redisgraph.js

Repository files navigation

license CircleCI GitHub issues npm version Codecov Known Vulnerabilities

redisgraph.js

Forum Discord

RedisGraph JavaScript Client - API Docs


Deprecation notice

This library is deprecated. node-redis. It's features have been merged into node-redis. Please either install it from npm or the repository.

Installation

Installation is done using the npm install command:

npm install redisgraph.js

For installing the latest snapshot use

npm install github:RedisGraph/redisgraph.js.git

Overview

Example: Using the JavaScript Client

const RedisGraph = require("redisgraph.js").Graph;

let graph = new RedisGraph("social");

(async () =>{
        await graph.query("CREATE (:person{name:'roi',age:32})");
        await graph.query("CREATE (:person{name:'amit',age:30})");
        await graph.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");

        // Match query.
        let res = await graph.query("MATCH (a:person)-[:knows]->(:person) RETURN a.name");
        while (res.hasNext()) {
            let record = res.next();
            console.log(record.get("a.name"));
        }
        console.log(res.getStatistics().queryExecutionTime());

        // Match with parameters.
        let param = {'age': 30};
        res = await graph.query("MATCH (a {age: $age}) return a.name", param);
        while (res.hasNext()) {
            let record = res.next();
            console.log(record.get("a.name"));
        }

        // Named paths matching.
        res = await graph.query("MATCH p = (a:person)-[:knows]->(:person) RETURN p");
        while (res.hasNext()) {
            let record = res.next();
            // See path.js for more path API.
            console.log(record.get("p").nodeCount);
        }
        graph.deleteGraph();
        graph.close();

    })();

Running tests

A simple test suite is provided, and can be run with:

$ npm test

The tests expect a Redis server with the RedisGraph module loaded to be available at localhost:6379

License

redisgraph.js is distributed under the BSD3 license - see LICENSE

Packages

No packages published

Contributors 12

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy