capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.

Home Page:https://capawesome.io/plugins/firebase/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat(firestore): add addCollectionGroupSnapshotListener

svrznjak opened this issue · comments

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Current problem

I am not sure but I think there is a very important feature missing. What I am trying to do is addCollectionSnapshotListener on collectionGroup query.
Such a thing can be done with javascript firebase library like this:
const resources = query(collectionGroup(getFirestore(), 'resources'));
onSnapshot(resources, (querySnapshot) => {
querySnapshot.forEach((doc) => {
console.log(doc.data());
});
});

Preferred solution

Since there already are getCollection, addCollectionSnapshotListener and getCollectionGroup functions in API, I would suggest addCollectionGroupSnapshotListener function is added.

I made a quick glance at addCollectionSnapshotListener web code and I think whole function can be copied and only change that is needed is on line 212 where 'collecion' should be changed to 'collectionGroup'.

Alternative options

No response

Additional context

No response

Before submitting

Thank you for your request. Would you be willing to create a PR?

Time files... Well, I am not familiar with capacitor plugins, but I can give it a try.

Let me know if you have any questions. I am currently working on other issues, so it will take some time until I get to this issue. You can also sponsor the issue if you want me to prioritize it.