react-redux-firebase
                                
                                
                                
                                    react-redux-firebase copied to clipboard
                            
                            
                            
                        How to populate from firestore within a subcollection ?
Hi,
I have a subcollection of ingredients containing data and a ref to the main ingredients collection.

I want to populate data on my subcollection with the data from the main ingredients collection.
I thought about doing something like this :
  useFirestoreConnect([
    {
      collection: "users_lists",
      doc: listId,
      subcollections: [
        {
          collection: "ingredients",
          populates: [{ child: "ref", root: "ingredients" }],
        },
      ],
      storeAs: "my_ingredients",
    },
  ])
but i still the firestore object in my redux store :

I can't find in the doc how to do that.
Thanks for the help !
Hmm interesting use case - I believe the populate parameters should live on the top level. Also how are you selecting data from state?
I was expecting data to be populated in the redux store. To have a clean database with all needed data populated on the redux store and be able to pick what i need in it. I have to use connect ?
@GautierT Yes - populate attaches listeners for all needed data, which then goes into the redux store UNPOPULATED, this is so that you can populate in some places and not others if needed based on how you connect to state. To pull populated data out of state, use the populate util which grabs the data and combines it based on populate settings
@GautierT So is this good to close with that understanding? We might also want to clarify further in the populate docs
Hi. I'm unable to populate data between two collections if they are both at the top level in Firestore, but I'm struggling to populate data between two collections if they are in subcollections (2nd level) using the same populates parameter.
Are there instructions on populating data in subcollections?