Hacker News new | ask | show | jobs
by spamizbad 2848 days ago
Graph database aficionados, I have a question: What's the deal with most graph databases having a very limited number of types? It would be nice if we had more robust numeric types (integers and decimals rather than just doubles) and timestamps for example.
4 comments

Maybe Agensgraph would work for you? Based on postgresql, so you can use any of the postgresql types. Fairly new though.

https://www.postgresql.org/about/news/1848/

This is on the list of more than one teammate here at ArangoDB. But also not trivial to implement.
Can you elaborate why that is? Of all types I could come up with (beyond bool), integers and unsigned integers seem the most basic.
The simplest explanation is that ArangoDB uses JSON as dataformat to the outside world. JSON doesn't support these types like arbitrary exact decimal, or timestamps. Despite ArangoDB using VelocyPack internally, which is capabable of much more than JSON, a user will import JSON and get JSON back.

You can of course use datetime https://docs.arangodb.com/3.3/AQL/Functions/Date.html and decimals with a precision of 10E38 in ArangoDB but it is not as precise as in a relational database. If we want to be as precise as a relational DB, then we would have to say goodbye to JSON

MongoDB uses this to express decimals as JSON: { "$numberDecimal": "<number>" }
I suspect creating a specification based on what mongodb does/did might be the better approach - but a quick search for "typed json" turned up:

https://www.tjson.org/

Not sure if I'm a fan of the syntax - but some kind of open, sane, standard would be nice.

I can't speak for all graph stores, but in addition to ADB being json-native as described below, many graph users describe the types of any value, not just floats or ints, as a relation or property to the value itself.

So you'd never have any value; object, key, value of a string, int, float, or reference, without associated meta-data typing it elsewhere in the graph, and would be unlikely to operate on that data without making reference to those properties.

Neo4j has datetime types, spatial point type, int, float, etc.

See https://neo4j.com/docs/developer-manual/current/drivers/cyph...