Skip to content
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

Vuexfire: add "id" field to documentation #226

Closed
va-andrew opened this issue Dec 5, 2018 · 1 comment
Closed

Vuexfire: add "id" field to documentation #226

va-andrew opened this issue Dec 5, 2018 · 1 comment

Comments

@va-andrew
Copy link

It would be helpful to add a note for vuexfire that when you bind to a collection, items in that collection can access an id property. It wasn't obvious to me since aside from this, each object is just the document's data, and the id attribute doesn't show up when you print the object or inspect it with dev tools.

@posva
Copy link
Member

posva commented Dec 6, 2018

Yep, I need to write documentation in general, it's not just about the id 😓. I lack time and financial support from people to prioritise this. As a result I end up doing it during my free time the best I can... I still fix bugs quickly though

The thing about vuefire/vuexfire, is that it expects you to still know Firebase and use its SDK. When creating documents, you have access to an id property, that's why it is also there in documents. The reason it doesn't appear in console it's because it's made non enumerable to allow people easily create copies of their documents and modify them when doing updates:

// item is a bound document
const copy = {...item}
copy.value = 'new value'
collection.doc(item.id).update(copy)

This is similar to posva/vuexfire#28, I want to add more docs and id will be included. I will add it to #145

@posva posva closed this as completed Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants