1

I have an app that has this schema:

HOME -> Collection -> Document -> Collection -> Document

And code:

db.collection('coll').doc('doc').collection('subcoll').doc('subdoc')

But the problem I'm facing is that my app requires more pairs (1 to 3) of collections and documents nested in depth. Is this a problem?

How many pairs of collections and documents can I have in chain?

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Faiyaz Himmat
  • 53
  • 1
  • 5

2 Answers2

1

You can chain in depth up to a maximum of 100 subcollections. As per the offial documentation regarding usage and limits.

Maximum depth of subcollections: 100

Regarding your question:

Is this a problem?

As far as I know, Firestore can as quickly look up a node at level 1 as it can at level 100. So for a database as yours, depth should not be a factor that affects speed on a technical level.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
0

The maximum depth of subcollections is 100, as detailed here in the Firestore documentation.

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121