Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials Computer Science NoSQL Databases
Computer Science Beginner FREE

NoSQL Databases

Lesson 2 of 17 Beginner Interactive

NoSQL databases store data in non-relational formats — documents, key-value pairs, graphs, or columns.

Syntax

COMPUTER-SCIENCE
# Document: MongoDB
{ "name": "Alice", "scores": [95, 87] }

# Key-Value: Redis
SET user:1 "Alice"
GET user:1

# Graph: Neo4j
(Alice)-[:FRIENDS_WITH]->(Bob)
Document Database Concept
JAVASCRIPT
// MongoDB-style document
const user = {
    _id: "507f1f77bcf86cd799439011",
    name: "Alice",
    email: "alice@example.com",
    address: {
        city: "New York",
        zip: "10001"
    },
    hobbies: ["reading", "coding"],
    createdAt: new Date()
};

// Query concept
const query = { "address.city": "New York" };
console.log("Document:", JSON.stringify(user, null, 2));
console.log("Query:", query);

Practice

1
Exercise

When should you use NoSQL over SQL?

Answer
When you need flexible schemas, horizontal scaling, or work with unstructured data.

Quick Quiz

1

Which is a document database?

MongoDB is a document database that stores JSON-like documents.

Interview Questions

A consistency model where all nodes will eventually have the same data, but not immediately after a write. Common in distributed NoSQL systems.