Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to include sub-collection in each item of a collection #317

Open
jaytonic opened this issue Dec 31, 2023 · 0 comments
Open

How to include sub-collection in each item of a collection #317

jaytonic opened this issue Dec 31, 2023 · 0 comments

Comments

@jaytonic
Copy link

Hi,

I've a collection of items, which have a subcollection.

I currently get the collection like this:

  const [user] = useAuthState(auth);
  const householdsRef = collection(db, "households");
  const queryRef = query( householdsRef, where("participantsIds", "array-contains", user!.uid)  );
  const collectionRef = queryRef.withConverter(householdConverter);
  const [households, householdLoading, householdError, householdSnapshot] =  useCollectionData<Household>(collectionRef);

And I would like to consolidate my households collection with the invites sub-collection.

My understanding is that there is no built-in way of doing this with react-firebase-hooks, but I'm also lost on how to implement this myself, without loosing the real-time update of firebase.

My hope is that somebody already got the same issue and is willing to share its solution with me?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant