How to define the CollectionReference of a subcollection with the JS SDK V9?

Renaud Tarnec
Firebase Tips & Tricks
1 min readJan 7

I often see some questions on StackOverflow on how to define the CollectionReference corresponding to a subcollection, when using the JavaScript SDK Version 9.

IMO, the main reason for questions on this subject is that the official Firebase documentation does not show any example (at the time of writing this short article).

In the “Subcollections” section of the documentation (see above link) we do find a code example, but it shows how to define the DocumentReference of a…

Renaud Tarnec
Firebase Tips & Tricks

Google Developer Expert for Firebase / Full-Stack web application Dev & Architect