'Can I query across subcollections with firestoreConnect?
I read that Firestore can now query across subcollections. Is the firestoreConnect HOC from react-redux-firebase capable of utilizing this feature?
Solution 1:[1]
Collection Group Queries were released at Google I/O last week (May 7, 2019). A quick scan of the react-redux-firebase release notes shows no mention of them at this time, so it seems like they're not supported yet. You might want to file an issue/feature request for it and monitor said release notes for updates.
Solution 2:[2]
I read about that too. There is info about how to perform subcollection queries here: Link. I am not sure about react-redux however, what are your intentions?
Solution 3:[3]
//To query all subcolections with react-redux-firebase useFirestoreConnect function, use:
useFirestoreConnect([
{
collectionGroup: "COLLECTION_GROUP_NAME",
storeAs: "ANY_NAME",
},
]);
//To Read and save to a variable
let YOUR_VAR = useSelector(
(state) => state.firestore.ordered.ANY_NAME
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Frank van Puffelen |
| Solution 2 | Darrow Hartman |
| Solution 3 | Izzy Glen |
