mesqueeb/vuex-easy-firestore

Adding "in" or "array-contains" to the where clause

AdamBissonnette opened this issue · 0 comments

** Resolved : see edit for info **

It would be really handy if this library supported arrays searches in where clauses (in, array-contains, array-contains-any). I'm trying to share some assets between accounts and the rules work in Firestore but don't seem to get sent by vuex-easy-firestore (maybe because the clauses aren't recognized?) - if there is a way to do the following can it be added to your documentation?

['users', 'array-contains', firebaseUser.uid] or [firebaseUser.uid, 'in', 'users']

Either of these would be awesome to be able to use.

The current behaviour just seems to not send the where clause and nothing gets sent causing a permission validation issue. If there is a way to get around this any pointers would be appreciated :)!

Edit: I figured it out. My issue was that I was writing openDBChannel messages like this:
store.dispatch('AccountModule/openDBChannel', {where})

When I wrote a new where clause I just set it to whereShared so the line above looked like this: store.dispatch('AccountModule/openDBChannel', {whereShared})

Unfortunately for me it was looking for an actual variable called "where" - when I updated the syntax to:
store.dispatch('AccountModule/openDBChannel', {where: whereShared})

Then it worked fine :)

tl;dr I am not smart. It might be nice to add examples to the docs on how to use array-contains or in for other slow people like me. I'll let myself out.