What is a document database?

NoSQL Concepts

Miriam Antona

Software engineer

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

NoSQL Concepts

Document database - overview

Picture of the structure of document databases

  • Documents -> rows
  • Collections -> tables
NoSQL Concepts

Documents

  • Set of key-value pairs
  • Keys: strings
  • Values: numbers, strings, booleans, arrays or objects
  • Schemaless: no need to specify the structure
  • Formats: JSON, BSON, YAML, or XML
NoSQL Concepts

Documents - JSON format

{
  "user_id": 512,
  "name": "Carol",
  "last_name": "Harper",
  "email": "[email protected]",
  "address": {
    "street": "123 Sesame Street",
    "city": "New York City",
    "state": "New York",
    "country": "USA"
  },
  "hobbies": [
    "hiking",
    "painting"
  ]
}
NoSQL Concepts

Documents - queries

{
  "user_id": 512,
  "name": "Carol",
  "last_name": "Harper",
  "email": "[email protected]",
  "address": {
    "street": "123 Sesame Street",
    "city": "New York City",
    "state": "New York",
    "country": "USA"
  },
  "hobbies": [
    "hiking",
    "painting"
  ]
}
  • All the users who live in New York and like hiking
  • All the users older than 40
  • User's data by user_id
  • ...
NoSQL Concepts

Documents - polymorphic model

{
  "user_id": 512,
  "name": "Carol",
  "last_name": "Harper",
  "email": "[email protected]",
  "address": {
    "street": "123 Sesame Street",
    "city": "New York City",
    "state": "New York",
    "country": "USA"
  },
  "hobbies": [
    "hiking",
    "painting"
  ]
}
{
  "user_id": 513,
  "name": "Benjamin",
  "last_name": "Lieberman",
  "email": "[email protected]",
  "date_of_birth": "07/04/1984",
  "hobbies": [
    "reading"
  ]
}
NoSQL Concepts

Collections

  • Sets of documents
  • Store the same type of entities
  • Organize documents and collections by thinking about the queries
NoSQL Concepts

Popular document databases

Logos of some popular document databases.

NoSQL Concepts

Let's practice!

NoSQL Concepts

Preparing Video For Download...