Home > database >  In Firebase Firestore, how is snapshot `size` different from snapshot.docs `length`?
In Firebase Firestore, how is snapshot `size` different from snapshot.docs `length`?

Time:11-02

The definition of size under QuerySnapshot says:

size
size: number
The number of documents in the QuerySnapshot.

docs says

docs
docs: Array<QueryDocumentSnapshot<T>>
An array of all the documents in the QuerySnapshot.

As far as Firestore is concerned, is there an operational difference between doing let a = snap.docs.length and doing let a = snap.size?

Like for example, will size count things that Firestore knows about while the simple length of the array does not?

CodePudding user response:

These two values are exactly the same; both indicate the number of documents in the result set/query snapshot.

  • Related