0
const buildings = await COLLECTIONS.BUILDINGS.where('building', '==', 'tall').get();

buildings.forEach((doc) => {

                buildings.forEach((doc) => {
                    ????
                })
        

});

I've tried to use 'doc.set' to add a subcollection with some data to each document snapshot, but I get the error 'Property 'set' does not exist on type 'QueryDocumentSnapshot''

How do I add a subcollection with some data for each document?

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734
Malloc28
  • 25
  • 4
  • 1
    A snapshot is just an immutable data container. You can't do anything with it other than read the data out of it. You will need to to get a reference to the document you want to update, as shown in the [documentation](https://firebase.google.com/docs/firestore/manage-data/add-data). – Doug Stevenson Apr 22 '22 at 12:28

0 Answers0