现已推出具有 MongoDB 兼容性的 Firestore 企业版!
了解详情。
कोई डेटा स्ट्रक्चर चुनें
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
ध्यान रखें कि Cloud Firestore में डेटा को स्ट्रक्चर करते समय, आपके पास कुछ अलग-अलग विकल्प होते हैं:
- दस्तावेज़
- एक से ज़्यादा कलेक्शन
- दस्तावेज़ों में मौजूद सब-कलेक्शन
अपने इस्तेमाल के उदाहरण के हिसाब से, हर विकल्प के फ़ायदों पर विचार करें. इस गाइड में, क्रम के हिसाब से व्यवस्थित किए गए डेटा के कुछ उदाहरण दिए गए हैं.
दस्तावेज़ों में नेस्ट किया गया डेटा
दस्तावेज़ों में, ऐरे या मैप जैसे जटिल ऑब्जेक्ट नेस्ट किए जा सकते हैं.
- फ़ायदे: अगर आपके पास डेटा की ऐसी सूचियां हैं जिन्हें आपको अपने दस्तावेज़ों में रखना है, तो इस सुविधा को आसानी से सेट अप किया जा सकता है. साथ ही, इससे आपके डेटा स्ट्रक्चर को व्यवस्थित करने में मदद मिलती है.
-
सीमाएं:
यह तरीका, अन्य तरीकों की तरह आसानी से नहीं बढ़ाया जा सकता. ऐसा खास तौर पर तब होता है, जब समय के साथ आपका डेटा बढ़ता जाता है. बड़ी या बढ़ती हुई सूचियों की वजह से, दस्तावेज़ का साइज़ भी बढ़ता है. इससे दस्तावेज़ को वापस पाने में ज़्यादा समय लग सकता है.
- इसका इस्तेमाल कैसे किया जा सकता है? उदाहरण के लिए, किसी चैट ऐप्लिकेशन में, किसी उपयोगकर्ता की प्रोफ़ाइल में, हाल ही में विज़िट किए गए तीन चैट रूम को नेस्ट की गई सूची के तौर पर सेव किया जा सकता है.
|
- class alovelace
- name :
first : "Ada"
last : "Lovelace"
born : 1815
rooms :
0 : "Software Chat"
1 : "Famous Figures"
2 : "Famous SWEs"
|
सब-कलेक्शन
अगर आपके पास ऐसा डेटा है जो समय के साथ बढ़ सकता है, तो दस्तावेज़ों में कलेक्शन बनाए जा सकते हैं.
- फ़ायदे: आपकी सूचियों के बढ़ने पर, पैरंट दस्तावेज़ के साइज़ में कोई बदलाव नहीं होता. आपको सब-कलेक्शन पर क्वेरी करने की पूरी सुविधाएं भी मिलती हैं. साथ ही, सब-कलेक्शन में
कलेक्शन ग्रुप क्वेरी जारी की जा सकती हैं.
-
सीमाएं: सब-कलेक्शन को आसानी से नहीं मिटाया जा सकता.
- इसका इस्तेमाल कैसे किया जा सकता है? एक ही चैट ऐप्लिकेशन में, चैट रूम के दस्तावेज़ों में उपयोगकर्ताओं या मैसेज के कलेक्शन बनाए जा सकते हैं. उदाहरण के लिए, ऐसा किया जा सकता है.
|
- collections_bookmark विज्ञान
- class software
name : "software chat"
- collections_bookmark
users
- class
alovelace
first : "Ada"
last : "Lovelace"
- class
sride
first : "Sally"
last : "Ride"`
- class ऐस्ट्रोफ़िज़िक्स
|
रूट-लेवल के कलेक्शन
अलग-अलग डेटा सेट को व्यवस्थित करने के लिए, अपने डेटाबेस के रूट लेवल पर कलेक्शन बनाएं.
- फ़ायदे: रूट-लेवल के कलेक्शन, कई-से-कई संबंधों के लिए अच्छे होते हैं. साथ ही, हर कलेक्शन में बेहतर तरीके से क्वेरी करने की सुविधा देते हैं.
-
सीमाएं: डेटाबेस के बढ़ने पर, स्वाभाविक रूप से क्रमबद्ध डेटा को पाना ज़्यादा मुश्किल हो सकता है.
- इसका इस्तेमाल कैसे किया जा सकता है? एक ही चैट ऐप्लिकेशन में, उपयोगकर्ताओं के लिए एक कलेक्शन और रूम और मैसेज के लिए दूसरा कलेक्शन बनाया जा सकता है.
|
- collections_bookmark
users
- class alovelace
first : "Ada"
last : "Lovelace"
born : 1815
- class sride
first : "Sally"
last : "Ride"
born : 1951
- collections_bookmark rooms
- class software
- collections_bookmark
messages
- class
message1
from : "alovelace"
content : "..."
- class
message2
from : "sride"
content : "..."
|
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-16 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-16 (UTC) को अपडेट किया गया."],[],[],null,["\u003cbr /\u003e\n\nRemember, when you structure your data in Cloud Firestore, you\nhave a few different options:\n\n- Documents\n- Multiple collections\n- Subcollections within documents\n\nConsider the advantages of each option as they\nrelate to your use case. A few example structures for hierarchical data\nare outlined in this guide.\n\n\u003cbr /\u003e\n\nNested data in documents\n\nYou can nest complex objects like arrays or maps within documents.\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| - **Advantages:** If you have simple, fixed lists of data that you want to keep within your documents, this is easy to set up and streamlines your data structure. - **Limitations:** This isn't as scalable as other options, especially if your data expands over time. With larger or growing lists, the document also grows, which can lead to slower document retrieval times. - **What's a possible use case?** In a chat app, for example, you might store a user's 3 most recently visited chat rooms as a nested list in their profile. | - class alovelace - name : first : \"Ada\" last : \"Lovelace\" born : 1815 rooms : 0 : \"Software Chat\" 1 : \"Famous Figures\" 2 : \"Famous SWEs\" |\n\nSubcollections\n\nYou can create collections within documents when you have data that might expand\nover time.\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - **Advantages:** As your lists grow, the size of the parent document doesn't change. You also get full query capabilities on subcollections, and you can issue [collection group queries](../query-data/queries) across subcollections. - **Limitations:** You can't easily delete subcollections. - **What's a possible use case?** In the same chat app, for example, you might create collections of users or messages within chat room documents. | - collections_bookmark science - class software name : \"software chat\" - collections_bookmark users - class alovelace first : \"Ada\" last : \"Lovelace\" - class sride first : \"Sally\" last : \"Ride\"\\` \u003cbr /\u003e \u003cbr /\u003e - class astrophysics - ... |\n\nRoot-level collections\n\nCreate collections at the root level of your database to organize disparate data\nsets.\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - **Advantages:** Root-level collections are good for many-to-many relationships and provide powerful querying within each collection. - **Limitations:** Getting data that is naturally hierarchical might become increasingly complex as your database grows. - **What's a possible use case?** In the same chat app, for example, you might create one collection for users and another for rooms and messages. | - collections_bookmark users - class alovelace first : \"Ada\" last : \"Lovelace\" born : 1815 - class sride first : \"Sally\" last : \"Ride\" born : 1951 - collections_bookmark rooms - class software - collections_bookmark messages - class message1 from : \"alovelace\" content : \"...\" - class message2 from : \"sride\" content : \"...\" |"]]