The readSnapshot utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document’s data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.
Working with Firestore document snapshots often requires extracting data and document IDs. The readSnapshot function automates this process, making it more efficient and error-proof, especially when dealing with non-existent documents.
Invoke readSnapshot with a document snapshot to get the document’s data and ID:
// Read data from the snapshotconst docData = readSnapshot(docSnapshot)// docData contains the document's data and ID, or is undefined if the document doesn't exist
readSnapshot gracefully handles non-existent documents by returning undefined, allowing for easy checking and preventing errors due to null or undefined values.
Use readSnapshot in Firestore read operations to standardize how you handle document data extraction.
Combine readSnapshot with other Firestore utilities to create a cohesive data handling workflow.
Always check for undefined returns when dealing with optional or non-existent documents.
Ensure that you handle the undefined case in your code to gracefully manage
scenarios where the document does not exist.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Firebridge","colors":{"primary":"#36656B","light":"#DAF1F4","dark":"#36656B"},"favicon":"/favicon.svg","logo":{"light":"https://mintcdn.com/humancollective/oNaxoG7QbCmsD9Gt/logo/light.svg?fit=max\u0026auto=format\u0026n=oNaxoG7QbCmsD9Gt\u0026q=85\u0026s=19a786e3b49034489f469d223f640a91","dark":"https://mintcdn.com/humancollective/oNaxoG7QbCmsD9Gt/logo/dark.svg?fit=max\u0026auto=format\u0026n=oNaxoG7QbCmsD9Gt\u0026q=85\u0026s=5ab41e88ab90b2cf7147044fcf65c387"},"background":{"decoration":null,"color":{"light":"#f3f8f8","dark":"#1e2a2e"}},"navbar":{"primary":{"type":"button","label":"Github","href":"https://github.com/firebridgekit/Firebridge"}},"footer":{"socials":{"github":"https://github.com/firebridgekit/Firebridge"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"humancollective","hasAudioNarration":false,"actualSubdomain":"humancollective","customDomains":["firebridge.dev"],"gitSource":{"type":"github","owner":"firebridgekit","repo":"firebridge","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21a6025634a55fb597136b","collectionId":"35ec6246-3e30-4bc4-b309-ee939fc07198","schemaVersion":"v2"},"entitlements":{},"buildId":"6a21a6025634a55fb597136b:success","clientVersion":"0.0.4006","searchFilterCounts":[{"language":"default","tag":"Cloud","count":26},{"language":"default","tag":"Actions","count":7},{"language":"default","tag":"Timestamps","count":6},{"language":"default","tag":"Metrics","count":5},{"language":"default","tag":"React","count":4},{"language":"default","tag":"Snapshots","count":3},{"language":"default","tag":"Hooks","count":3},{"language":"default","tag":"Execution","count":2},{"language":"default","tag":"Invokeables","count":2},{"language":"default","tag":"Introduction","count":2}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"cloud/snapshots/readSnapshot","slug":"/cloud/snapshots/readSnapshot","pageMetadata":{"title":"readSnapshot","description":"The `readSnapshot` utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document's data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.","icon":"code","href":"/cloud/snapshots/readSnapshot"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"The \", _jsx(_components.code, {\n children: \"readSnapshot\"\n }), \" utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document’s data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.\"]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`introduction`,children:`Introduction`}),`\n`,_jsxs(_components.p,{children:[`Working with Firestore document snapshots often requires extracting data and document IDs. The `,_jsx(_components.code,{children:`readSnapshot`}),` function automates this process, making it more efficient and error-proof, especially when dealing with non-existent documents.`]}),`\n`,_jsx(Heading,{level:`3`,id:`key-features`,children:`Key Features`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Convenience`}),`: Automatically extracts data and ID from a Firestore document snapshot.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Safety`}),`: Returns undefined for non-existent documents, avoiding null reference errors.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Generic Typing`}),`: Supports generic typing for document data, ensuring type safety.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`utilization`,children:`Utilization`}),`\n`,_jsx(Heading,{level:`4`,id:`preparing-for-document-reads`,children:`Preparing for Document Reads`}),`\n`,_jsxs(_components.p,{children:[`Import `,_jsx(_components.code,{children:`readSnapshot`}),` and use it to read data from a Firestore document snapshot:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`firestore`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'firebase-admin'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`readSnapshot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'path-to-your-utilities'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Assuming 'docSnapshot' is a Firestore document snapshot`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` docSnapshot`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` firestore`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`DocumentSnapshot`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` firestore`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`doc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'path/to/doc'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`extracting-data-from-a-snapshot`,children:`Extracting Data from a Snapshot`}),`\n`,_jsxs(_components.p,{children:[`Invoke `,_jsx(_components.code,{children:`readSnapshot`}),` with a document snapshot to get the document’s data and ID:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Read data from the snapshot`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` docData`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` readSnapshot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`docSnapshot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// docData contains the document's data and ID, or is undefined if the document doesn't exist`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`handling-non-existent-documents`,children:`Handling Non-Existent Documents`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`readSnapshot`}),` gracefully handles non-existent documents by returning undefined, allowing for easy checking and preventing errors due to null or undefined values.`]}),`\n`,_jsx(Heading,{level:`2`,id:`best-practices`,children:`Best Practices`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Use `,_jsx(_components.code,{children:`readSnapshot`}),` in Firestore read operations to standardize how you handle document data extraction.`]}),`\n`,_jsxs(_components.li,{children:[`Combine `,_jsx(_components.code,{children:`readSnapshot`}),` with other Firestore utilities to create a cohesive data handling workflow.`]}),`\n`,_jsx(_components.li,{children:`Always check for undefined returns when dealing with optional or non-existent documents.`}),`\n`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Ensure that you handle the undefined case in your code to gracefully manage\nscenarios where the document does not exist.`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"readSnapshot","description":"The `readSnapshot` utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document's data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.","icon":"code","href":"/cloud/snapshots/readSnapshot"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Introduction","slug":"introduction","depth":2,"children":[{"title":"Key Features","slug":"key-features","depth":3,"children":[]},{"title":"Utilization","slug":"utilization","depth":3,"children":[]},{"title":"Preparing for Document Reads","slug":"preparing-for-document-reads","depth":4,"children":[]},{"title":"Extracting Data from a Snapshot","slug":"extracting-data-from-a-snapshot","depth":4,"children":[]}]},{"title":"Handling Non-Existent Documents","slug":"handling-non-existent-documents","depth":2,"children":[]},{"title":"Best Practices","slug":"best-practices","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"humancollective","siteName":"Firebridge","title":"readSnapshot - Firebridge","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T00:45:36.613Z","originalFileLocation":"cloud/snapshots/readSnapshot.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"The readSnapshot utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document\u0026#x27;s data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Firebridge\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"readSnapshot - Firebridge\">\u003cmeta data-mint-head property=\"og:description\" content=\"The readSnapshot utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document\u0026#x27;s data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Firebridge\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://firebridge.dev/cloud/snapshots/readSnapshot\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://humancollective.mintlify.app/_mintlify/api/og/v2?division=Snapshots\u0026amp;title=readSnapshot\u0026amp;description=The+%60readSnapshot%60+utility+simplifies+the+process+of+extracting+data+from+Firestore+document+snapshots.+It+neatly+packages+the+document%27s+data+along+with+its+ID\u0026amp;theme=494a5b55d5af8e2e45aa7d13\u0026amp;signature=b4e9813536fc83efec9f221c2497a51f3cb7066f8291de2a62d251758840ac80\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"readSnapshot - Firebridge\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"The readSnapshot utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document\u0026#x27;s data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://humancollective.mintlify.app/_mintlify/api/og/v2?division=Snapshots\u0026amp;title=readSnapshot\u0026amp;description=The+%60readSnapshot%60+utility+simplifies+the+process+of+extracting+data+from+Firestore+document+snapshots.+It+neatly+packages+the+document%27s+data+along+with+its+ID\u0026amp;theme=494a5b55d5af8e2e45aa7d13\u0026amp;signature=b4e9813536fc83efec9f221c2497a51f3cb7066f8291de2a62d251758840ac80\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/humancollective/6f5gtnvP6iWrC6WE/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Firebridge\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#36656B\">\u003clink data-mint-head rel=\"canonical\" href=\"https://firebridge.dev/cloud/snapshots/readSnapshot\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/cloud/snapshots/readSnapshot.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://firebridge.dev/#organization\",\"name\":\"Firebridge\",\"url\":\"https://firebridge.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/humancollective/oNaxoG7QbCmsD9Gt/logo/light.svg?fit=max\u0026auto=format\u0026n=oNaxoG7QbCmsD9Gt\u0026q=85\u0026s=19a786e3b49034489f469d223f640a91\"}},{\"@type\":\"WebSite\",\"@id\":\"https://firebridge.dev#website\",\"name\":\"Firebridge\",\"url\":\"https://firebridge.dev\",\"publisher\":{\"@id\":\"https://firebridge.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://firebridge.dev/cloud/snapshots/readSnapshot#webpage\",\"url\":\"https://firebridge.dev/cloud/snapshots/readSnapshot\",\"name\":\"readSnapshot\",\"description\":\"The readSnapshot utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document's data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.\",\"dateModified\":\"2026-01-07T00:45:36.613Z\",\"isPartOf\":{\"@id\":\"https://firebridge.dev#website\"},\"breadcrumb\":{\"@id\":\"https://firebridge.dev/cloud/snapshots/readSnapshot#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://firebridge.dev/cloud/snapshots/readSnapshot#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Cloud\",\"item\":\"https://firebridge.dev/cloud/cloud-installation\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Snapshots\",\"item\":\"https://firebridge.dev/cloud/snapshots/getChangeType\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"readSnapshot\",\"item\":\"https://firebridge.dev/cloud/snapshots/readSnapshot\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://firebridge.dev/cloud/snapshots/readSnapshot#article\",\"headline\":\"readSnapshot\",\"name\":\"readSnapshot\",\"description\":\"The readSnapshot utility simplifies the process of extracting data from Firestore document snapshots. It neatly packages the document's data along with its ID, or returns undefined if the document does not exist, streamlining Firestore document reads.\",\"url\":\"https://firebridge.dev/cloud/snapshots/readSnapshot\",\"mainEntityOfPage\":{\"@id\":\"https://firebridge.dev/cloud/snapshots/readSnapshot#webpage\"},\"dateModified\":\"2026-01-07T00:45:36.613Z\",\"publisher\":{\"@id\":\"https://firebridge.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://firebridge.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Firebridge\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Firebridge","nav":{"global":null,"groups":[{"group":"Introduction","pages":[{"title":"Why Firebridge?","href":"/introduction"},{"title":"Get Started","href":"/get-started"}]},{"group":"React","pages":[{"title":"React Installation","icon":"react","href":"/react/react-installation"},{"group":"Hooks","pages":[{"title":"useDocument","icon":"code","href":"/react/hooks/useDocument"},{"title":"useCollection","icon":"code","href":"/react/hooks/useCollection"},{"title":"useCallable","icon":"code","href":"/react/hooks/useCallable"}]}]},{"group":"Cloud","pages":[{"title":"Cloud Installation","icon":"cloud","href":"/cloud/cloud-installation"},{"group":"Invokeables","pages":[{"title":"Callables","icon":"code","href":"/cloud/invokeables/callable"},{"title":"Requestables","icon":"code","href":"/cloud/invokeables/requestable"}]},{"group":"Execution","pages":[{"title":"Batch Execution","icon":"code","href":"/cloud/execution/batch"},{"title":"Parallel Execution","icon":"code","href":"/cloud/execution/parallel"}]},{"group":"Actions","pages":[{"title":"Actions Overview","href":"/cloud/actions/actions-overview"},{"title":"firestoreAdd","icon":"code","href":"/cloud/actions/firestoreAdd"},{"title":"firestoreDelete","icon":"code","href":"/cloud/actions/firestoreDelete"},{"title":"firestoreGet","icon":"code","href":"/cloud/actions/firestoreGet"},{"title":"firestoreSet","icon":"code","href":"/cloud/actions/firestoreSet"},{"title":"firestoreUpdate","icon":"code","href":"/cloud/actions/firestoreUpdate"},{"title":"firestoreMerge","icon":"code","href":"/cloud/actions/firestoreMerge"}]},{"group":"Snapshots","pages":[{"title":"Change Types","description":"Detecting document changes within Firestore Cloud Functions is essential for real-time data handling. The `getChangeType` utility facilitates this by categorizing document changes, making it easier to implement responsive and efficient cloud functions.","icon":"code","href":"/cloud/snapshots/getChangeType"},{"title":"readSnapshot","icon":"code","href":"/cloud/snapshots/readSnapshot"},{"title":"readQuerySnapshot","description":"The `readQuerySnapshot` utility efficiently processes Firestore query snapshots, converting them into an array of document data objects, each paired with its corresponding document ID. It filters out non-existent documents, ensuring clean and reliable data arrays.","icon":"code","href":"/cloud/snapshots/readQuerySnapshot"}]},{"group":"Timestamps","pages":[{"title":"maxTimestamp","icon":"code","href":"/cloud/timestamps/maxTimestamp"},{"title":"hydrateAllTimestamps","icon":"code","href":"/cloud/timestamps/hydrateAllTimestamps"},{"title":"hydrateTimestamp","icon":"code","href":"/cloud/timestamps/hydrateTimestamp"},{"title":"minTimestamp","icon":"code","href":"/cloud/timestamps/minTimestamp"},{"title":"sortTimestamps","icon":"code","href":"/cloud/timestamps/sortTimestamps"},{"title":"timestampToDate","icon":"code","href":"/cloud/timestamps/timestampToDate"}]},{"group":"Metrics","pages":[{"title":"Metrics Overview","href":"/cloud/metrics/overview"},{"title":"incrementMetric","href":"/cloud/metrics/increment"},{"title":"updateMetric","href":"/cloud/metrics/update"},{"title":"Types Reference","href":"/cloud/metrics/types"},{"title":"Utilities","href":"/cloud/metrics/utilities"}]}]}]},"title":"readSnapshot - Firebridge","buildId":"dpl_2xiSHD9XEvLsPGPcfoMtkLTB3dy9","deploymentId":"dpl_2xiSHD9XEvLsPGPcfoMtkLTB3dy9","dynamics":[],"chunks":[]}