Closed as not planned
Description
Reproduction
Please see step 2
Steps to reproduce the bug
- Create a document in firestore that contain a field named
id
such as
{
"id": "123",
"name": "test document"
}
- Read the document via vuefire and print it out
import {doc, getFirestore} from 'firebase/firestore';
const firestore = getFirestore();
const docStm = useDocument(doc(firestore, 'AnyCol/AnyDoc'));
watch(docStm, console.log, {immediate: true});
- Check the console
{
"id": "AnyDoc",
"name": "test document"
}
Expected behavior
id should be 123
Actual behavior
id is overrided to document ID (AnyDoc
)
Additional information
It is good for vuefire to provide access to document id but I think it should not use a normal field name id
, since it is a valid field name for firestore too. Use a special field name such as .id
can avoid conflict with document data.
One constraint about the firestore document field name is 'not start with a dot(.
)'.
Also, as suggested in #180, I think the following properties should be exposed to the vuefire data object as non-enumerable properties:
- the snapshot itself (optional, better if provided)
- all properties(id, metadata, ref) of document snapshot
- some properties(metadata, queery) of query snapshot
Metadata
Metadata
Assignees
Labels
No labels