An options object that configures the behavior of get() calls on
DocumentReference and Query. By providing a GetOptions object, these
methods can be configured to fetch results only from the server, only from
the local cache or attempt to fetch results from the server and fall back to
the cache (which is the default).
Describes whether we should get from server or cache.
Setting to default (or not setting at all), causes Firestore to try to
retrieve an up-to-date (server-retrieved) snapshot, but fall back to
returning cached data if the server can't be reached.
Setting to server causes Firestore to avoid the cache, generating an
error if the server cannot be reached. Note that the cache will still be
updated if the server request succeeds. Also note that latency-compensation
still takes effect, so any pending write operations will be visible in the
returned data (merged into the server-provided data).
Setting to cache causes Firestore to immediately return a value from the
cache, ignoring the server completely (implying that the returned value
may be stale with respect to the value on the server.) If there is no data
in the cache to satisfy the get() call, DocumentReference.get() will
return an error and QuerySnapshot.get() will return an empty
QuerySnapshot with no documents.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-07-27 UTC."],[],[],null,["- [firebase](/docs/reference/node/firebase).\n- [firestore](/docs/reference/node/firebase.firestore).\n- GetOptions \nAn options object that configures the behavior of `get()` calls on\n`DocumentReference` and `Query`. By providing a `GetOptions` object, these\nmethods can be configured to fetch results only from the server, only from\nthe local cache or attempt to fetch results from the server and fall back to\nthe cache (which is the default).\n\nIndex\n\nProperties\n\n- [source](/docs/reference/node/firebase.firestore.GetOptions#source)\n\nProperties\n\nOptional source \nsource: \"default\" \\| \"server\" \\| \"cache\" \nDescribes whether we should get from server or cache.\n\nSetting to `default` (or not setting at all), causes Firestore to try to\nretrieve an up-to-date (server-retrieved) snapshot, but fall back to\nreturning cached data if the server can't be reached.\n\nSetting to `server` causes Firestore to avoid the cache, generating an\nerror if the server cannot be reached. Note that the cache will still be\nupdated if the server request succeeds. Also note that latency-compensation\nstill takes effect, so any pending write operations will be visible in the\nreturned data (merged into the server-provided data).\n\nSetting to `cache` causes Firestore to immediately return a value from the\ncache, ignoring the server completely (implying that the returned value\nmay be stale with respect to the value on the server.) If there is no data\nin the cache to satisfy the `get()` call, `DocumentReference.get()` will\nreturn an error and `QuerySnapshot.get()` will return an empty\n`QuerySnapshot` with no documents."]]
An options object that configures the behavior of
get()
calls onDocumentReference
andQuery
. By providing aGetOptions
object, these methods can be configured to fetch results only from the server, only from the local cache or attempt to fetch results from the server and fall back to the cache (which is the default).