DEV Community

Cover image for Neo4j, A Database on Crack 🚬
Tausif
Tausif

Posted on • Edited on

Neo4j, A Database on Crack 🚬

Lol What?

It's good. I mean it. You do not have SQL like rigid tables holding your data, foreign keys to map relation. It's not plain key-value pairs like Mongodb, either. Instead, you have this:

Neo4j Overview

The connecting line is the "Relation" between two objects (or Node), which is a foreign-key in sql, or reference in Mongodb. But the difference is, you define the relation just as is:

CREATE (you:Person)-[relation:LEARNING]->(js:Language)
Enter fullscreen mode Exit fullscreen mode

Any Superpowers?

Yes. It's relational, but at the same time free of the rigidity that comes with SQL tables. It's nosql (cypher), but free from the lacking of proper relationship in Mongodb. it's the best of the both worlds.

Tell me more

Everything is a Node. You draw lines to connect them. And that's relationship. This is how a Node looks like:

Neo4j Node

This is how you connect these Nodes:

Neo4j Relation

Why isn't it everywhere?

  • Performance sucks compared to Postgres and Mysql.

  • Important features like Sharding and Live Backup - are behind a very expensive corporate license.

  • Their cloud service (Aura) starts at 65$/month. The service was announced in 2021. It's fully managed, and getting good traction.

  • No support for querying nested properties/fields like MongoDB. Manually parsing JSON string is the way to go.

Give it a go

Query a Neo4j database using Cypher - Getting Started

A high-level overview of the graph query language Cypher.

favicon neo4j.com

Top comments (0)