Documentation
Official
- Guides
- Get to know Cloud Firestore videos
- The Firebase Blog
- Google Groups
- Cloud Firestore API
- Use the Cloud Firestore REST API
Blogs
- Working with Firestore: Building a simple database model
- NoSQL Data Modeling Techniqu
- RBAC with Google Firestore
- Firestore NoSQL Relational Data Modeling
- Advanced Data Modeling With Firestore by Example
Tools
- Firebase console
- Cloud console
- APIs Explorer
- Cloud Functions for Firebase: Typescript with Firebase Firestore
Limits
Notes from videos:
- max 1 MB of data in a single document
- max 20k of fields in a single document (including maps)
- 1 write/second on a single document
- can't retrieve a partial document
- queries are shallow by default
- billed by the number of reads and writes performed (2m read requests = $.12)
- queries find documents in single (sub)collection
- arrays are weird
- you can't run 2 "array contains" queries on the same array
- There's a limit to how many documents you can create per minute in a single collection if the documents have an always-increasing value (like a timestamp)
- Very large collections don't do as well from a performance standpoint when you're offline.
Notes from docs:
- Querying across multiple subcollections is not currently supported in Cloud Firestore. (collection group query). If you need to query data across collections, use root-level collections.*
- Array: An array cannot contain another array value as one of its elements. Map: Represents an object embedded within a document. When indexed, you can query on subfields. If you exclude this value from indexing, then all subfields are also excluded from indexing.*
- Cloud Firestore automatically maintains an index for each field in a document and each subfield in a map. Exempt from auto-indexing: large string/array/map fields, timestamps.*
- You also get full query capabilities on subcollections (individual, not multiple).*
Emulator local install
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
3) Install Java JDK (JRE is not enough)
npm install -g firebase-tools
firebase login
firebase setup:emulators:firestore
6) Install @firebase/testing module
npm install @firebase/testing
firebase serve --only firestore