mesqueeb / vuex-easy-firestore

Easy coupling of firestore and a vuex module. 2-way sync with 0 boilerplate!
https://mesqueeb.github.io/vuex-easy-firestore
MIT License
234 stars 28 forks source link

CollectionGroup Query #248

Open deathmaster9 opened 5 years ago

deathmaster9 commented 5 years ago

Can we use vuex-easy-firestore to run CollectionGroup Queries ? This new feature of Firestore can make more natural some database designs. Thanks for your help on this issue.

Great package by the way. Thanks for your work.

mesqueeb commented 5 years ago

Hi @deathmaster9 thanks for your post.

I've considered CollectionGroup queries before, but I couldn't think of a good use case.

The basic philosophy of vuex-easy-firestore is (1 module == 1 firestore path).

So I'm not sure how to fit CollectionGroup queries in there. 😄

Can you explain more about your specific use case?

mesqueeb commented 4 years ago

After about two years of open source, I finally got accepted for Github Sponsors!

💜 github.com/sponsors/mesqueeb 💜

A little about me:

If anyone was helped with vuex-easy-firestore, I'd greatly appreciate any support!

BTW, donations get's paid DOUBLE by GitHub! (they're alchemists... 🦾)

Going forward 👨🏼‍💻

louisameline commented 4 years ago

While this isn't a priority, I could see how it would happen. There would be an action on a collection to run a collection group queries. When the results come in, we'd have to create the doc submodule, the subcollection subsubmodule, and the sub-collection document subsubsubmodule. Piece of cake ;)

The only thing to be aware of is that collection group queries in Firestore run against all collections that have the provided name, so the results will be unexpected if there are subcollections of the same name under a collection other than the one we query against in v-e-f.

berendsmatt commented 4 years ago

I have a similar use case to what is presented here. https://firebase.googleblog.com/2019/06/understanding-collection-group-queries.html

mesqueeb commented 4 years ago

You mean something like this?

And you'd want 1 v-e-f module for all "reviews" across restaurants?

berendsmatt commented 4 years ago

That would be fantastic. I have a few cases where this would be useful. Currently I would make a batch to add/edit documents in multiple collections (eg. staff list, org list, and user list). Would be nice to have them under the user list, but be able to build the other lists needed from it.

(...though I just realise this example isn't the best as my rules need to prevent org from reading all user lists)

louisameline commented 4 years ago

I don't think @berendsmatt actually cares if they are in a same module or not, as long as he has an easy way to iterate on them, right?

berendsmatt commented 4 years ago

Sorry late reply (Christmas holidays),

As long as they can be sorted and filtered together.