Skip to content

Add DocumentSnapshot.entries to Firestore #186

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

Closed
brettwillis opened this issue May 24, 2021 · 2 comments
Closed

Add DocumentSnapshot.entries to Firestore #186

brettwillis opened this issue May 24, 2021 · 2 comments
Labels
API coverage Request for missing APIs

Comments

@brettwillis
Copy link

With the current API, there is no way to retrieve unknown fields from a DocumentSnapshot, only known fields can be retrieved (e.g. with contains() and get()).

The DocumentSnapshot needs to also expose a map-like API, like below:

val size: Int
val entries: Set<Pair<String, Any>>
val keys: Set<String>
val values: Collection<Any>

This allows enumeration of all fields, not just those known at compile-time.

@brettwillis brettwillis added the API coverage Request for missing APIs label May 24, 2021
@nbransby
Copy link
Member

Thanks @brettwillis could you attach links to the relevant class members from the native firebase sdk reference documentation?

@brettwillis
Copy link
Author

brettwillis commented May 31, 2021

getData() returns a Map<String, Any>, which allows enumeration of arbitrary keys and values.

You could either implement a Map-like interface directly on the DocumentSnapshot class, or implement getMap() or something which returns the native Map<String, Any>...

@Reedyuk Reedyuk closed this as completed in 4a434a5 Sep 1, 2021
Reedyuk added a commit that referenced this issue Sep 1, 2021
added DocumentSnapshot.dataMap() (fixes #186)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API coverage Request for missing APIs
Projects
None yet
Development

No branches or pull requests

2 participants