-
-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying which references are automatically bound to avoid right errors #281
Comments
Will have to think about a convenient api to customize keys that works well with nested documents |
I'm still reading vuefire internals, but I had some ideas DatasetThere're two collections: {
name: 'Luke',
father: ref_to_darth_vader_doc,
saber: ref_to_saber_doc
} RulesI only want to retrieve father, cause my user can only read people collection, not saber Ideas1 - My first idea was to create an "exclude" option, where you pass the keys you want to exclude: export default {
data () {
luke: null
},
methods: {
bindLuke () {
const options = {
excludeKeys: ['saber']
}
this.$bind('luke', database.collection('people').doc(lukeId), options)
}
}
} 2 - Passing only keys is easier, but when handling subcollections this solution is not scalable. Maybe if we filter it by which document the reference is referring to it becomes better. For instance, we can use wildcards just like firebase rules to exclude entire collections from the binding: const options = {
excludePaths: ['sabers/{saberId}']
} This second option only works if we want to exclude the ref cause the user doesn't have access to it. 3 - So, my third idea is to use the wildcards syntax but for the keys path, not collections path: const options = {
excludePaths: ['people/[wildcard or luke id]/saber']
} 4 - Maybe it could work without wildcards, but with references. But the implementation is not very clear to me: const options = {
exclude: [{ collection: database.collection('people'), key: 'saber' }]
}
// or even
const options = {
exclude: [{ collection: 'people', key: 'saber' }]
} |
What's the progress of this? |
I came here to suggest this, but found it's been suggested. It seems like it wouldn't be very hard to do - I may even give it a shot. But before I dig in, does anyone know if this is already being considered or worked on for the next version? |
Currently if a reference data type's depth is not more than
maxRefDepth
then it is by default binded. Instead there should be a way to override default behavior and specify the keys of the fields which should be binded.The text was updated successfully, but these errors were encountered: