'In Redisgraph, how can I store the numeric value of 0?

I'm using Redisgraph. I'm using this query:

MERGE (p:Person { age: 0 } )
RETURN p

But what I get is age: "".

If I query:

MERGE (p:Person { age: 12 } )
RETURN p

This correctly store age: 12 (without quotes).

How can I store the numeric value of 0? Thank you!



Solution 1:[1]

A minimal example which create a node with an attribute with the value 0 and retrieves it using redisgraph.js

const RedisGraph = require("redisgraph.js").Graph;
let graph = new RedisGraph("G");

(async () =>{
        await graph.query("CREATE (:L {v:0})");
        let res = await graph.query("MATCH (a) RETURN a, a.v");
        while (res.hasNext()) {
            let record = res.next();
            console.log(record.get("a"));
            console.log(record.get("a.v"));
        }

        graph.deleteGraph();
        graph.close();
    
    })();

Output:

Node { id: 1, label: undefined, properties: { v: 0 } }
0 

@albertoSpinella would you mind sharing a reproducible snippet?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SWilly22