I'm having problems querying Firestore with Vue.js.
This are my rules on Firestore:
service firebase.storage {
match /databases/{database}/documents {
match /users/{userid=**} {
function getRole(role){
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.roles[role]
}
allow read, write: if getRole('admin') == true
}
}
}
This is my structure, if I have to change it, it doesn't matter. I'm learning, I want to make the best practices:
-users[Collection]
-userID[Document]
-forms[Collection]
-author: userID
-name: "name"
-roles: {
-admin: true
}
and this is the query that I'm trying with Vue.js:
usersRef.doc(`${this.user.uid}`).collection('forms').where('author', '==', true).get().then(snapshot => {
console.log(snapshot)
})