با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Firestore یک راه حل پایگاه داده مقیاس پذیر خوب برای همگام نگه داشتن داده ها در بین کلاینت های وب است.
برای بسیاری از برنامهها، پشتیبانی آفلاین مدیریت شده Firestore اهمیت ویژهای دارد و به شما امکان میدهد برنامههای پاسخگو بسازید که بدون توجه به تأخیر شبکه یا اتصال اینترنت کار میکنند. اما SDK های غنی از ویژگی ها هزینه اندازه دارند. Firebase برای برنامههایی که فقط نیاز به استفاده از عملیات اولیه ایجاد، خواندن، بهروزرسانی و حذف دارند و نیازی به پشتیبانی آفلاین مدیریت شده ندارند، چه چیزی ارائه میکند؟
راه حل: Firestore Lite
Firestore Lite یک Firestore SDK سبک و مستقل فقط REST است که از واکشی سند تکی، اجرای پرس و جو و به روز رسانی سند در کسری از اندازه Web SDK معمولی پشتیبانی می کند. Firestore Lite جبران تأخیر، ذخیره آفلاین، از سرگیری پرس و جو و شنوندگان عکس فوری را حذف نمی کند، اما برای موارد استفاده خاص، کاهش اندازه کتابخانه و زمان راه اندازی یک معامله عالی ایجاد می کند.
وارد کردن Firestore Lite
Firestore Lite از طریق npm به عنوان بخشی از SDK مدولار در دسترس است. بنابراین کاملاً مدولار و درختی تکانپذیر است.
ویژگیهای API توسط Firestore Lite پشتیبانی نمیشوند
برای اندازه و سرعت، Firestore Lite این ویژگیها را از Firestore SDK استاندارد حذف میکند:
کنترل کننده رویداد DocumentSnapshot . متد onSnapshot و اشیاء DocumentChange ، SnapshotListenerOptions ، SnapshotMetadata ، SnapshotOptions و Unsubscribe شامل نمیشوند.
یاران پایداری . روشهای enableIndexedDBPersistence ، enableMultiTabIndexedDbPersistence ، و clearIndexedDbPersistence شامل نمیشوند.
بسته های آتش نشانی . متد loadBundle و روشهای مرتبط، و اشیاء LoadBundleTask و LoadBundleTaskProgress شامل نمیشوند.
پیاده سازی واکشی اسناد، پرس و جو و به روز رسانی
پس از وارد کردن Firestore Lite، میتوانید تماسهای دریافت و بهروزرسانی همه API آشنا را برقرار کنید. موارد استفاده برای افزودن داده و دریافت داده همه اعمال می شود.
تصمیم گیری در مورد اینکه چه زمانی از ویژگی های ماندگاری آفلاین و حافظه پنهان Firestore SDK استاندارد کنار گذاشته شود، می تواند مشکل باشد. قبل از اینکه تصمیم بگیرید آنها را با سربار پایینتر Firestore Lite معاوضه کنید، باید این ویژگیها را درک کنید. به طور کلی، هنگام تصمیم گیری در مورد استفاده از Firestore Lite، این عوامل را بسنجید:
وضعیت آنلاین - Firestore Lite برای برنامه هایی مناسب است که نیازی به به روز رسانی زنده ندارند و اتصال دارند.
محدودیتهای اندازه - اگر میخواهید اندازه کلی بسته جاوا اسکریپت خود را کاهش دهید، Firestore Lite عالی است.
تاریخ آخرین بهروزرسانی 2025-08-15 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-15 بهوقت ساعت هماهنگ جهانی."],[],[],null,["\u003cbr /\u003e\n\nFirestore is a good scalable database solution to keep data in sync across Web\nclients.\n\nFor many apps, Firestore's managed offline support is especially important,\nletting you build responsive apps that work regardless of network latency or\nInternet connectivity. But feature-rich SDKs come at a size cost. What\ndoes Firebase offer for apps that only need to use basic create, read, update\nand delete operations, and don't need managed offline support?\n| **Note:** Before using Firestore Lite, be sure you understand the standard Firestore Web API and Firestore's offline capabilities as part of the full [feature set](../index.html). We recommend Firestore Lite for developers who have experience building with Firestore and can evaluate the tradeoffs of using a lightweight version.\n\nSolution: Firestore Lite\n\nFirestore Lite is a lightweight, standalone REST-only Firestore SDK that\nsupports single document fetches, query execution, and document updates, at a\nfraction of the regular Web SDK size. Firestore Lite omits latency compensation,\noffline caching, query resumption and snapshot listeners, but for particular\nuse cases, the reductions in library size and startup time make a great tradeoff.\n\nImport Firestore Lite\n\nFirestore Lite is available via npm as part of the\n[modular SDK](//firebase.google.com/docs/web/learn-more#modular-version). It is\nthus fully modular and tree-shakeable.\n\nThe following import style is supported. \n\n import { initializeApp } from \"firebase/app\";\n import {\n getFirestore,\n getDoc,\n updateDoc\n } from 'firebase/firestore/lite';\n\nAPI features not supported by Firestore Lite\n\nFor size and speed, Firestore Lite omits these features from the standard\nFirestore SDK:\n\n- **DocumentSnapshot event handlers** . The `onSnapshot` method and `DocumentChange`, `SnapshotListenerOptions`, `SnapshotMetadata`, `SnapshotOptions` and `Unsubscribe` objects are not included.\n- **Persistence helpers** . The `enableIndexedDBPersistence`, `enableMultiTabIndexedDbPersistence`, and `clearIndexedDbPersistence` methods are not included.\n- **Firestore bundles** . The `loadBundle` method and related methods, and the `LoadBundleTask` and `LoadBundleTaskProgress` objects are not included.\n\nImplement document fetches, queries and updates\n\nAfter importing Firestore Lite, you can make all of the familiar API get\nand update calls. The use cases for [adding data](../manage-data/add-data)\nand [getting data](../query-data/get-data) all apply. \n\n import {\n getFirestore,\n getDoc,\n updateDoc,\n doc\n } from '@firebase/firestore/lite';\n\n const firestore = getFirestore(app);\n const docRef = doc(firestore, 'collection/doc');\n const docSnap = await getDoc(docRef);\n await updateDoc(docRef, \"field\", 'value');\n\nWhen to use Firestore Lite\n\nIt can be tricky to decide when to let go of the standard Firestore SDK's\noffline persistence and caching features. You should understand these features\nbefore deciding to trade them away for the lower overhead of Firestore Lite. In\ngeneral, weigh these factors when deciding whether to use Firestore Lite:\n\n- **Online status** - Firestore Lite is good for apps that do not need live updates and have connectivity.\n- **Size constraints** - Firestore Lite is great if you want to reduce your overall JavaScript bundle size."]]