0

I have a flutter app where I'm fetching a List of names based on a certain condition from a top-level collection called /students and displaying it one of my screens.

Now I want the user to select these names, with a CheckBoxListTile and then confirm to add these selected names into a deeply nested subcollection of /departments/cse/2017/6 B 17/students/, how do I accomplish this in an efficient way?

I basically want to write all the documents at once into the sub-collection from my List <Student> selectedStudents while maintaining their firebase userId as the docuemntId in that collection of students.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
sameer kashyap
  • 1,121
  • 1
  • 9
  • 14
  • 1
    If you're asking what the fastest way to write documents is, have a look at: https://stackoverflow.com/questions/58897274/what-is-the-fastest-way-to-write-a-lot-of-documents-to-firestore – Frank van Puffelen Feb 14 '20 at 15:20
  • Are you trying to do it fast or minimizing the calls? – Soni Sol Feb 15 '20 at 03:02
  • @FrankvanPuffelen Not excatly the fastest way, I want to know how I can wrtie it the best with minimum writes being a priority. Fast would help too. Becuase I'm not sure how to perform Batch Writes yet so was trying to seel out if that is the way to do what I'm trying to accomplish . And I have read your previous answer before , but wasn't sure if that's excatly what i wanted as you comapred fastest way to do it. – sameer kashyap Feb 15 '20 at 08:36
  • @JoséSoní Yes, I'm trying to do it in the least write calls possible so it doesn't cross the firestore limit of free writes. Was wondering how I could exactly do it – sameer kashyap Feb 15 '20 at 08:37

1 Answers1

0

In Firestore writes are counted in a way that each document will count as one write.

therefor the objective of not hitting a limit will not happen.

Soni Sol
  • 2,367
  • 3
  • 12
  • 23