Skip to content

Expose databaseId and projectId on Firestore class #1936

@IchordeDionysos

Description

@IchordeDionysos

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.

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/nodejs-firestore API.priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions