Given the introducing of multiple databases it becomes more and more often that you want to know from where a Reference or snapshot was created for.
Right now there is no way to go from a DocumentReference or a DocumentSnapshot to the database or the project.
It should simply be possible to do the following:
reference.firestore.databaseId
reference.firestore.projectId
Those getters already exist but they are marked a private/internal making accessing them in Typescript unavailable.
Right now you need to do some fishy stuff accessing internal variables, silencing Typescript errors (using as any) or other unofficial, undocumented things.
Given those things are not officially supported and APIs may change without proper breaking changes this makes depending on those workarounds, not a solution.
Given the introducing of multiple databases it becomes more and more often that you want to know from where a Reference or snapshot was created for.
Right now there is no way to go from a
DocumentReferenceor aDocumentSnapshotto the database or the project.It should simply be possible to do the following:
Those getters already exist but they are marked a private/internal making accessing them in Typescript unavailable.
Right now you need to do some fishy stuff accessing internal variables, silencing Typescript errors (using
as any) or other unofficial, undocumented things.Given those things are not officially supported and APIs may change without proper breaking changes this makes depending on those workarounds, not a solution.