Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

firebase - Get the size/number of fields of a particular document in Firestore using flutter

Is there any way to get the size of a particular document in Firestore using flutter? I need the number of fields in a particular document.

I'm trying to get the total number of fields in a particular document , however i can retrieve the number of documents in a collection but not the number of fields in a document .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As an alternative, you could keep track of the number of fields of each document in a separate document. Suppose a document has two fields

document_1
    name_field
    age_field

then in a separate collection we keep track of the number of fields, using the same document id:

document_field_count
   document_1
      count: 2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...