0Pricing
MongoDB Academy · Lezione

Varianti NoSQL: documenti, chiave-valore, colonne, grafi

Confronterà le quattro famiglie NoSQL e assocerà ciascuna ai relativi casi d'uso reali.

Varianti NoSQL: documenti, chiave-valore, colonne, grafi è una lezione MongoDB Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento MongoDB Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso MongoDB Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

The NoSQL Family Tree

"NoSQL" isn't one thing — it's a family of four: document, key-value, wide-column, and graph stores. MongoDB is a document store. Let's meet them all.

Document Stores: Rich Nested Data

Document stores keep data as flexible JSON-like documents, with nested objects and arrays all in one place. MongoDB leads here — the most versatile NoSQL type.

// Document store example - a product document
{
  _id: 'prod_001',
  name: 'Wireless Headphones',
  category: 'Electronics',
  specs: { battery: '30h', connectivity: 'Bluetooth 5.0' },
  reviews: [
    { user: 'alice', rating: 5, comment: 'Great!' }
  ],
  price: 79.99
}

Key-Value Stores: Blazing Fast Simplicity

Key-value stores like Redis are the simplest: every item is just a key and a value. Lookups are instant, perfect for caches, sessions, and leaderboards.

// Redis key-value example
SET session:user_42 '{"userId":42,"token":"abc123","expiresAt":1700000000}'
GET session:user_42
// Returns the JSON string immediately - O(1) lookup

// Redis also supports richer structures per key:
LPUSH leaderboard 'alice:9500'
LPUSH leaderboard 'bob:8700'
LRANGE leaderboard 0 9  // top 10

Wide-Column Stores: Analytical Scale

Wide-column stores like Cassandra spread data across many machines and swallow huge write loads. Ideal for IoT sensors, logs, and time-series data.

// Cassandra CQL - wide-column table design
CREATE TABLE sensor_readings (
  device_id  UUID,
  recorded_at TIMESTAMP,
  temperature FLOAT,
  humidity    FLOAT,
  PRIMARY KEY (device_id, recorded_at)
) WITH CLUSTERING ORDER BY (recorded_at DESC);
// Partition key = device_id; clustering key = recorded_at

Graph Databases: Relationships First

Graph databases like Neo4j store connections as first-class data, so they fly through relationships. Great for social networks, fraud rings, and recommendations.

// Neo4j Cypher query - find friends of friends
MATCH (me:Person {name: 'Alice'})
      -[:FRIENDS_WITH]->(friend)
      -[:FRIENDS_WITH]->(foaf)
WHERE NOT (me)-[:FRIENDS_WITH]->(foaf)
  AND foaf <> me
RETURN foaf.name AS suggestion
LIMIT 10;

Comparing the Four Families

Each family shines somewhere: documents for most apps, key-value for caching, wide-column for IoT, graph for relationships. Always ask: how will I query my data?

When to Use a Document Store

Reach for a document store like MongoDB when your data is nested, your schema keeps changing, and you want rich queries without painful JOINs.

Multi-Model Databases

Big systems often mix databases — a pattern called polyglot persistence. MongoDB for data, Redis for caching, each tool doing what it does best.

NewSQL: The Best of Both Worlds?

NewSQL databases like CockroachDB try to blend NoSQL's scaling with SQL's safety. The SQL vs NoSQL choice is less black-and-white than it used to be.

MongoDB in the NoSQL Landscape

MongoDB leads document stores thanks to its BSON format, rich queries, ACID transactions, and the Atlas cloud platform. Often your first and best NoSQL stop.

Choosing the Right NoSQL Family

Quick guide: single-key lookups go to Redis, relationships to Neo4j, time-series to Cassandra, rich nested data to MongoDB. Unsure? MongoDB is a safe start.

Quick Check

Test your understanding of MongoDB & NoSQL Databases concepts from this lesson.

Lesson Recap

You met the four NoSQL families, saw why MongoDB's documents fit most apps, and learned how polyglot persistence mixes tools. Next: the CAP theorem.

Domande Frequenti

La lezione «Varianti NoSQL: documenti, chiave-valore, colonne, grafi» è gratuita?

Sì — il testo completo di «Varianti NoSQL: documenti, chiave-valore, colonne, grafi» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso MongoDB Academy, passa a CoddyKit PRO. Il corso MongoDB Academy include 4 lezioni in totale.

Cosa imparerò in «Varianti NoSQL: documenti, chiave-valore, colonne, grafi»?

Confronterà le quattro famiglie NoSQL e assocerà ciascuna ai relativi casi d'uso reali. Eserciti MongoDB Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare MongoDB Academy?

Non è richiesta alcuna esperienza precedente. MongoDB Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.

Quanto tempo richiede la lezione «Varianti NoSQL: documenti, chiave-valore, colonne, grafi»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione MongoDB Academy?

Sì. Ogni lezione MongoDB Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Il collo di bottiglia dei database relazionali
  2. Varianti NoSQL: documenti, chiave-valore, colonne, grafi
  3. Il teorema CAP in parole semplici
  4. Il ruolo di MongoDB
← Torna a MongoDB Academy