polymerfire
polymerfire copied to clipboard
Firestore collection (mixin) items don't have the $key field (used in dom-repeat)
Description
The old database and firebase-query added an extra $key
field to every item.
But the new firestore collection (mixin) does not, but instead uses __id__
.
Expected outcome
Either keep it the same in both DBs or point out that __id__
can be used, the same way $key
is described:
https://www.webcomponents.org/element/firebase/polymerfire/elements/firebase-query
Actual outcome
For now, __id__
has to be used instead of $key
(which is fine for me, just need to know).
I’m actually considering making a PR to change __id__
to __name__
. The latter is used in official firestore docs and implementation.
I'm fine with both, as long as it is shown and documented.
In Firestore it seems to me that both are beeing used (I think ID is more often used, but NAME is used in security rules on resources..):
- ID: https://firebase.google.com/docs/reference/js/firebase.firestore.DocumentSnapshot
- ID: https://cloud.google.com/nodejs/docs/reference/firestore/0.10.x/QueryDocumentSnapshot
- NAME: https://firebase.google.com/docs/firestore/reference/security/
id
is used as a property on snapshots, while __name__
is used when it refers to a property of an entity itself, in security rules as you've mentioned, but also for ordering etc.
Since we use it as a latter, I'd prefer the __name__
.
That would be great to have some feedback from the maintainers :) @tjmonsi @mbleigh
name refers to a fully qualified path including collections, id to the document id. We should keep id.
On Mon, Jan 8, 2018, 2:41 AM Natan Sągol [email protected] wrote:
id is used as a property on snapshots, while name is used when it refers to a property of an entity itself, in security rules as you've mentioned, but also for ordering etc.
Since we use it as a latter, I'd prefer the name.
That would be great to have some feedback from the maintainers :) @tjmonsi https://github.com/tjmonsi @mbleigh https://github.com/mbleigh
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/firebase/polymerfire/issues/306#issuecomment-355932920, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAD_kKOvsvAozeXCSMd6o2MzZHUGqreks5tIfDogaJpZM4QXBM4 .
Ok, good to know.
Sorry guys, just wondering where this firestore mixin is ? I see questions posted about it and discussions but cannot find it in the repo! Cheers
https://github.com/firebase/polymerfire/tree/firestore
It's not in the master yet.