0

i have the following database model: car Workshops collection which is the root collections, and it has collections based on car Brands for example car Workshops ==> KIA(collection) and KIA collection have some fields and another sub collections called workshops

as following car Workshops ==> Kia (collection) ==> workshops

so i wants my code to return the wokrshops which is inside kia collection

screenshots of my database

enter image description here

  • 1
    There's nothing special about doing this in Cloud Functions. Did you try anything yet? If not, this might be a good place to look: https://stackoverflow.com/questions/58656602/is-there-a-way-to-get-all-documents-in-a-subcollection-firestore – Frank van Puffelen May 13 '22 at 18:16
  • @FrankvanPuffelen yes I have manged to do it, nothing special in doing it in cloud function i know, but I have to make it with cloud function because I use this data in more complex. Operations with cloud functions – Othman Abdealziz May 14 '22 at 15:41

1 Answers1

2

U can use collection group query with specified document id. Try this, its work for me. CollectionGroupQuery but limit search to subcollections under a particular document

Gie
  • 93
  • 6