Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Story
How we grew from 0 to 3 million users
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

Firestore Data Modeling - Five Cool Techniques

250.1K views
•
April 18, 2019
by
Fireship
YouTube video player
Firestore Data Modeling - Five Cool Techniques

TL;DR

Learn about five different ways to structure and query data in Firestore, including modeling relational data, filtering by categories, using composite strings for hierarchical structures, joining data from different collections, and building a social media follower feed.

Transcript

one of the most challenging aspects of building any app is determining the optimal data structure ideally you want to maximize performance while minimizing costs but that's easier said than done and especially so with a no SQL database like firestore because you really have to plan ahead on how you model your data last week I asked everybody on our... Read More

Key Insights

  • 😀 Building an app with Firestore requires careful data structure planning to optimize performance and minimize queries.
  • 🍵 Firestore can effectively handle relational data modeling by rethinking the approach.
  • 🤱 Techniques covered in the video include querying based on user mentions, filtering and querying by multiple categories, using composite strings for hierarchical structures, joining data from different collections, and building a follower feed system.
  • 🧡 Firestore provides operators like array contains, order by, and range operators to facilitate querying and filtering data efficiently.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How can Firestore handle querying based on user mentions in posts?

Firestore allows storing an array of mentioned usernames on the post document as a way of managing the many-to-many relationship. By querying the post collection with an array contains operator and the user ID, all tweets mentioning a particular user can be obtained. A cloud function can be set up to trigger push notifications or emails when a user is mentioned.

Q: Can Firestore handle filtering and querying based on multiple categories and allowing for exclusion of specific values?

Yes, this can be achieved by using a tags collection to hold tag-related data and associating these tags with the posts using a map. To filter by multiple tags simultaneously (logical AND), multiple where statements with equal to operators can be chained together. For logical OR queries, individual queries for separate tags can be run concurrently and joined together. The limitation is that only one range operator can be used per query.

Q: How can composite strings be used in Firestore for hierarchical structures like threaded comments?

Composite strings enable efficient traversal in hierarchical structures. By creating a composite key where the elements correspond to the parent documents' IDs, it becomes possible to query specific nodes in the tree. By using range operators in the query (greater than or equal to parent ID and less than or equal to parent ID + a high Unicode character), traversal down the tree can be achieved.

Q: How can Firestore join data from different collections efficiently?

Although denormalization is preferred in Firestore, in cases where embedding data is not practical, data can be joined using multiple read requests sent concurrently. By mapping an array of IDs to document reads and resolving all promises concurrently using Promise.all, the joined data can be retrieved efficiently.

Summary & Key Takeaways

  • Building a successful app requires careful data structure planning, especially with a NoSQL database like Firestore. Modeling data to fit the app's view, minimizing queries, and maximizing performance is crucial.

  • Firestore, contrary to popular belief, can handle relational data modeling effectively by rethinking the approach.

  • Techniques covered in the video include querying based on user mentions in posts, using tags for filtering and querying by multiple categories, using composite strings for hierarchical structures like threaded comments, joining data from different collections, and creating a follower feed system.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Fireship 📚

How Did Soham Parekh Exploit Remote Work for Multiple Jobs? thumbnail
How Did Soham Parekh Exploit Remote Work for Multiple Jobs?
Fireship
What Are the Key Concepts in Computer Science? thumbnail
What Are the Key Concepts in Computer Science?
Fireship
How to Build a Video Editing Tool with React and WebAssembly thumbnail
How to Build a Video Editing Tool with React and WebAssembly
Fireship
How to Build a RESTful API with Node.js Express thumbnail
How to Build a RESTful API with Node.js Express
Fireship
Build a Chatbot from Scratch - Dialogflow on Node.js thumbnail
Build a Chatbot from Scratch - Dialogflow on Node.js
Fireship
Vim in 100 Seconds thumbnail
Vim in 100 Seconds
Fireship

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots
  • Open Graph Checker

Company

  • About us
  • Our Story
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.