简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM