Back to Firebase Js Sdk

SnapshotOptions interface

docs-devsite/firestore_.snapshotoptions.md

12.12.12.0 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

SnapshotOptions interface

Options that configure how data is retrieved from a DocumentSnapshot (for example the desired behavior for server timestamps that have not yet been set to their final value).

<b>Signature:</b>

typescript
export declare interface SnapshotOptions 

Properties

PropertyTypeDescription
serverTimestamps'estimate' | 'previous' | 'none'If set, controls the return value for server timestamps that have not yet been set to their final value.<!-- -->By specifying 'estimate', pending server timestamps return an estimate based on the local clock. This estimate will differ from the final value and cause these values to change once the server result becomes available.<!-- -->By specifying 'previous', pending timestamps will be ignored and return their previous value instead.<!-- -->If omitted or set to 'none', <code>null</code> will be returned by default until the server value becomes available.

SnapshotOptions.serverTimestamps

If set, controls the return value for server timestamps that have not yet been set to their final value.

By specifying 'estimate', pending server timestamps return an estimate based on the local clock. This estimate will differ from the final value and cause these values to change once the server result becomes available.

By specifying 'previous', pending timestamps will be ignored and return their previous value instead.

If omitted or set to 'none', null will be returned by default until the server value becomes available.

<b>Signature:</b>

typescript
readonly serverTimestamps?: 'estimate' | 'previous' | 'none';