question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(question) Recursive subscription

See original GitHub issue

What would be the best approach to subscribe to any change in the tree?

My firestore document layout

rootcollection
    doc1
       subcollection11
          subdoc1
          subdoc2
    doc2
       subcollection21

For example

  • root level doc addition/removal/change
  • subcollection addition/removal/change
  • subdoc1 addition/removal/change

I tried

import { getFirestore } from 'redux-firestore';
getFirestore().get('/rootcollection') or getFirestore().setListeners('/rootcollection')

But it did not give me any data on subcollection level. Do i need to handle the subscription myself on client level? Or is there a better way?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
prescottpruecommented, May 11, 2018

There is not currently a way to check for subcollections that you don’t know the name of using Firestore’s client API, they suggest doing it within a cloud function with the Firebase Admin SDK as mentioned in this stackoverflow post and a few places in the Firebase docs.

My suggestion is to have a function handle getting the subcollection name using the admin SDK, then you can call that function from the client. Once the client has the subcollection name it can query for the data it needs. Be careful with security when using this pattern though.

0reactions
prescottpruecommented, Jul 29, 2018

Going to close since there are a few options for how to do this with functions, and it isn’t supported with the client SDK.

Read more comments on GitHub >

github_iconTop Results From Across the Web

computer science - What kind of problem is the membership ...
What kind of problem is the membership problem of a recursive enumerable language, as opposed to the membership problem of a non r.e....
Read more >
rxjs - Wait for Subscription set Recursively to Complete
I want to wait until each item in the array is recursively updated before the subscription is complete. The hidden field will be...
Read more >
Recursion - LeetCode
# Title Acceptance Difficulty 2 Add Two Numbers 39.9% Medium 10 Regular Expression Matching 28.2% Hard 21 Merge Two Sorted Lists 62.0% Easy
Read more >
5 Simple Steps for Solving Any Recursive Problem - YouTube
5 Simple Steps for Solving Any Recursive Problem. 822K views · 3 years ago ...more. Reducible. 224K. Subscribe. 28K. Share. Save. Report ...
Read more >
Recursion for Coding Interviews: The Ultimate Guide
Here are a couple questions you can ask yourself to decide whether you should solve a given problem recursively: Does the problem fit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found