One Page

Firebase Firestore Quickstart

July 19, 2019

  1. Collections hold documents.
  2. Documents hold data.
  3. Every odd numbered segment of your path, is a collection. Eg: /cities is a collection. /cities/mumbai is a doc. /cities/mumbai/districts is a collection

Reading data

You use get on a document to get the doc, then doc.data() to get the data inside.

Writing data

  1. Using set({name:‘Aniket’}) writes the data to the given document erasing everything else inside it
  2. Using update({name: ‘Aniket’}) writes data to a document, only changing the values you’ve specified. If there was more data it would remain intact.

Eg: If we’d started with the document data as {name: 'AniketSMK', eye_colour:'black'} then the outcome of the above commands would be:

  1. {name:'Aniket'}
  2. {name:'Aniket', eye_colour:'black'}

Have suggestions for a topic I should cover? Send me a dm at @AniketSMK or email me at hello@[firstname][lastname].com


Aniket Kadam, author

Written by Aniket Kadam - building useful things. Follow me on Twitter