When to use document databases

NoSQL Concepts

Miriam Antona

Software engineer

Suitable cases

  • Catalogs
    • E-commerce web sites/applications store product information
    • Different attributes between the products
    • Embed related information

Picture of a shirt

{
  "product_id": 879,
  "name": "Fashion shirt",
  "category": {
    "category_id": 15,
    "name": "Tops & t-shirts",
    "type": "Shirt"
  }
}
NoSQL Concepts

Suitable cases

  • Event logging
    • Types of events:
      • User logging
      • Product purchase
      • Errors
      • ...
    • Sharding by:
      • Time
      • Type of event
      • ...

Picture of the log of an event

{
  "type": "info",
  "message": "user_logged",
  "user_id": 551,
  ...
}
NoSQL Concepts

Suitable cases

  • User profiles
{
  "user_id": 512,
  "name": "Carol",
  "last_name": "Harper",
  "email": "[email protected]",
  "address": {
    "street": "123 Sesame Street",
    "city": "New York City",
    "state": "New York"
  },
  ...
}

Image of a user profile.

  • Information may vary
  • Document flexibility
NoSQL Concepts

Suitable cases

  • Content management systems
    • Blogs, video platforms, etc.
    • Users' content
      • Comments
      • Images
      • Videos
      • ...

Image of a blog

{
  "id": 458,
  "url": "myblog/datazy.com",
  "title": "How to write a blog entry at Datazy",
  "tags": [
    "Datazy",
    "Blog"
  ],
  "last10comments": [
    { "name": "Eliza", "comment": "Great!" },
    { "name": "Eric", "comment": "Thank you!"}
  ]...
}
NoSQL Concepts

Suitable cases

  • Real-time analytics
    • Page views, unique visitors...
    • Easy to store the information

Image of real-time analysis

{
  "_id": "1000241",
  "hour": "Sat Jun 12 2021 16:40:00 GMT+0200 (EST)",
  "site": "datazy",
  "uniques": 5,
  "pageviews": 15,
  ...
}
NoSQL Concepts

Unsuitable cases

  • Very structured data
  • Always have consistent data
NoSQL Concepts

Let's practice!

NoSQL Concepts

Preparing Video For Download...