InterviewHubPRO
Section Overview
Q40

Question 40 of 60

Part 3: NoSQL & Document Databases (MongoDB, DynamoDB) (26 - 40)

67%
Databases & System Design•Part 3: NoSQL & Document Databases (MongoDB, DynamoDB) (26 - 40)

Wide-Column (Cassandra) vs Graph (Neo4j):

In Simple Words:

  • Cassandra: High-write distributed storage across multiple datacenters.
  • Neo4j: Graph database storing nodes and edges; constant-time traversal across deep relationships (social networks, fraud detection).
cypher
// Neo4j Cypher query: Find friends of friends who like 'Node.js':
MATCH (u:User {name: 'Alice'})-[:FRIEND]->(f:User)-[:FRIEND]->(fof:User)
WHERE (fof)-[:LIKES]->(:Skill {name: 'Node.js'})
RETURN DISTINCT fof.name;