Neo4j
is a primary database. It stores the graph itself: every node and relation, the ownership and access relations which the access is based on, and the scalar properties of elements. Neo4j is needed for every request, see .
What it stores
| Values | Stored as |
|---|---|
boolean, integer, number, datetime, elementId | native values, by default |
string of up to 1024 characters | STRING, by default |
vector | list of numbers, if placed here |
point | native POINT (WGS 84), if placed here |
Neo4j has no nested values, so objects and lists are stored in MongoDB. It has no native type for lines and areas either: linestring, polygon and the multi geometries can not be stored in Neo4j, a schema which asks for it is rejected. See .
Indices
The intents exact (range index), fulltext (full-text index) and geo (point index) create indices in Neo4j for the properties which it stores, see . Raw Neo4j give full control, including indices over several properties.
Limits
- Supernodes: a supernode is a node with a very large number of relations, e.g. a group with millions of members or a tag which is used for most elements. Neo4j stores the relations of a node as a chain, so expanding such a node touches all of them, which makes queries which pass through it slow, even if they only need a few of its relations. Neo4j has no hard limit for this, but the performance degrades. Avoid modelling hubs where possible: split them (e.g. one tag collection per year), or filter by relation type, which Neo4j can use to skip relations.
- Long strings: strings of more than 1024 characters are stored in MongoDB by default, as they slow down the graph.
- Vectors: vector indices of Neo4j support at most 4096 dimensions.
Migrations
A creates the range, text and point indices which the properties stored in Neo4j ask for with index, and the raw Neo4j of properties and of the schema. Indices of properties which the schema does not define anymore are dropped, indices of another type or of other properties are replaced, and indices which Neo4j reports in the state FAILED are dropped and created again. Text indices need Neo4j 5.0 or newer; the steps which a version can not provide are blocking and run before any step of any database, so nothing has changed when they fail. Neo4j Community does not support constraints.