FirebaseExtended / FirebaseExtended/rxfire

Support Firestore SDK `SnapshotOptions`

Open
#58 0 comments 0 reactions 1 assignee Claimed by @davideast View on GitHub
Dominant language
TypeScript
Stars
149
Forks
50
PR merge metrics
No merged PRs in 30d

Description

When subscribing to Firestore data without using rxfire, the Firestore SDK (at least v9) supports [optional `SnapshotOptions`](https://firebase.google.com/docs/reference/node/firebase.firestore.SnapshotOptions) when getting data from a snapshot. E.g.

```ts
// Currently, the only SnapshotOption is `serverTimestamps`.
snap.data({ serverTimestamps: "estimate" });
```

When using `docData()` or `collectionData()`, in addition to allowing the user to provide an optional `idField`, I'd like to be able to provide `SnapshotOptions` and, specifically, the `serverTimestamps` option so that returned documents have an "estimate" timestamp value rather than `null`.

If it were possible, I might recommend upstreaming the `idField` option to the main Firebase SDK repo so that "idField" is added to `SnapshotOptions` and becomes officially supported. At that point, rxfire could simply pass all the `SnapshotOptions` provided to `docData` or `collectionData` internally to `snap.data(options)`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.