How to organize related temporal and fixed data in Firestore?Read related data using calendar in FirestoreHow do I fix android.os.NetworkOnMainThreadException?How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor versionGoogle Firestore data organizationHow to query data across collections in Firestore?Firebase Firestore - relational data design approachesfirestore rules to compare the inpudata and already existing dataStoring complex data model in cloud firestoreFirestore how to query data from collection where document reference contains specific query pathHow do I structure the Firestore JSON of a blog API many-to-many relationFirestore: How can I create a subcollection in Firestore without having to add a document already

Can you make an identity from this product?

Multiband vertical antenna not working as expected

Trying to get (more) accurate readings from thermistor (electronics, math, and code inside)

C++ logging library

Rail-to-rail op-amp only reaches 90% of VCC, works sometimes, not everytime

Why did the World Bank set the global poverty line at $1.90?

Housemarks (superimposed & combined letters, heraldry)

Do empty drive bays need to be filled?

Is it okay to have a sequel start immediately after the end of the first book?

Make Gimbap cutter

Assigning function to function pointer, const argument correctness?

So a part of my house disappeared... But not because of a chunk resetting

What is the reason for setting flaps 1 on the ground at high temperatures?

What should I discuss with my DM prior to my first game?

Is the Keras Embedding layer dependent on the target label?

Oil draining out shortly after turbo hose detached/broke

Could a person damage a jet airliner - from the outside - with their bare hands?

How to write a convincing religious myth?

If I had a daughter who (is/were/was) cute, I would be very happy

Are the guests in Westworld forbidden to tell the hosts that they are robots?

Is Dumbledore a human lie detector?

noalign caused by multirow and colors

Can there be absolute velocity?

Can the removal of a duty-free sales trolley result in a measurable reduction in emissions?



How to organize related temporal and fixed data in Firestore?


Read related data using calendar in FirestoreHow do I fix android.os.NetworkOnMainThreadException?How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor versionGoogle Firestore data organizationHow to query data across collections in Firestore?Firebase Firestore - relational data design approachesfirestore rules to compare the inpudata and already existing dataStoring complex data model in cloud firestoreFirestore how to query data from collection where document reference contains specific query pathHow do I structure the Firestore JSON of a blog API many-to-many relationFirestore: How can I create a subcollection in Firestore without having to add a document already






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I don't know how I can achieve this data structure in Firestore.



I have this structure:



Firestore-root
|
--- liturgia (collection)
| |
| --- lh (documents)
| |
| --- oficio (collection)
| |
| --- 03070101 (documents)
| |
| --- himno: "Today himno for today oficio"
| |
| --- read: "Today read for today oficio"
|
| --- 03070102 (documents)
| |
| --- himno: "Today himno for today oficio"
| |
| --- read: "Today read for today oficio"
|
| --- 09070325 (documents)
| |
| --- himno: "Today himno for today oficio"
| |
| --- read: "Today read for today oficio"
|
| --- laudes (collection)
| |
| --- 03070101 (documents)
| |
| --- himno: "Today himno for today laudes"
| |
| --- read: "Today read for today laudes"
|
| --- 03070102 (documents)
| |
| --- himno: "Today himno for today laudes"
| |
| --- read: "Today read for today laudes"
|
| --- 09070325 (documents)
| |
| --- himno: "Today himno for today laudes"
| |
| --- read: "Today read for today laudes"


In oficio or in laudes there are documents with fixed content, this content never change, and I need to use that content according to the date.



For example:



I have any date, on this date, one entire content is needed. For example, when I need to show the today content for oficio (or for laudes):



  • For 2019-03-25 i will need the content of 09070325


  • For 2019-03-26 i will need the content of 03070102



    ...



  • For 2020-03-25 i will need the content of 09070325



  • For 2020-03-26 i will need the content of 03070103



    ...



  • For 2021-03-25 i will need the content of 03070101


I think of a structure to relate the fixed content according to the dates, but I do not know how to do it.



In my application, the current date will be taken, and based on this data, must find the fixed content for oficio, for laudes, etc.



For example, in 2019-03-25 and in 2020-03-25 is needed the content 09070325, but in 2021-03-25 is needed the content 03070101:



20190325
oficio : 09070325
laudes : 09070325

20190326
oficio : 03070102
laudes : 03070102

20200325
oficio : 03070101
laudes : 03070101

20210325
oficio : 03070101
laudes : 03070101


How can I organize my data structure to:



  • not having to update the fixed content documents

  • put in relation the fixed content with the dates each year

  • obtain the fixed content according to a given date consuming the least amount of resources









share|improve this question






























    0















    I don't know how I can achieve this data structure in Firestore.



    I have this structure:



    Firestore-root
    |
    --- liturgia (collection)
    | |
    | --- lh (documents)
    | |
    | --- oficio (collection)
    | |
    | --- 03070101 (documents)
    | |
    | --- himno: "Today himno for today oficio"
    | |
    | --- read: "Today read for today oficio"
    |
    | --- 03070102 (documents)
    | |
    | --- himno: "Today himno for today oficio"
    | |
    | --- read: "Today read for today oficio"
    |
    | --- 09070325 (documents)
    | |
    | --- himno: "Today himno for today oficio"
    | |
    | --- read: "Today read for today oficio"
    |
    | --- laudes (collection)
    | |
    | --- 03070101 (documents)
    | |
    | --- himno: "Today himno for today laudes"
    | |
    | --- read: "Today read for today laudes"
    |
    | --- 03070102 (documents)
    | |
    | --- himno: "Today himno for today laudes"
    | |
    | --- read: "Today read for today laudes"
    |
    | --- 09070325 (documents)
    | |
    | --- himno: "Today himno for today laudes"
    | |
    | --- read: "Today read for today laudes"


    In oficio or in laudes there are documents with fixed content, this content never change, and I need to use that content according to the date.



    For example:



    I have any date, on this date, one entire content is needed. For example, when I need to show the today content for oficio (or for laudes):



    • For 2019-03-25 i will need the content of 09070325


    • For 2019-03-26 i will need the content of 03070102



      ...



    • For 2020-03-25 i will need the content of 09070325



    • For 2020-03-26 i will need the content of 03070103



      ...



    • For 2021-03-25 i will need the content of 03070101


    I think of a structure to relate the fixed content according to the dates, but I do not know how to do it.



    In my application, the current date will be taken, and based on this data, must find the fixed content for oficio, for laudes, etc.



    For example, in 2019-03-25 and in 2020-03-25 is needed the content 09070325, but in 2021-03-25 is needed the content 03070101:



    20190325
    oficio : 09070325
    laudes : 09070325

    20190326
    oficio : 03070102
    laudes : 03070102

    20200325
    oficio : 03070101
    laudes : 03070101

    20210325
    oficio : 03070101
    laudes : 03070101


    How can I organize my data structure to:



    • not having to update the fixed content documents

    • put in relation the fixed content with the dates each year

    • obtain the fixed content according to a given date consuming the least amount of resources









    share|improve this question


























      0












      0








      0


      1






      I don't know how I can achieve this data structure in Firestore.



      I have this structure:



      Firestore-root
      |
      --- liturgia (collection)
      | |
      | --- lh (documents)
      | |
      | --- oficio (collection)
      | |
      | --- 03070101 (documents)
      | |
      | --- himno: "Today himno for today oficio"
      | |
      | --- read: "Today read for today oficio"
      |
      | --- 03070102 (documents)
      | |
      | --- himno: "Today himno for today oficio"
      | |
      | --- read: "Today read for today oficio"
      |
      | --- 09070325 (documents)
      | |
      | --- himno: "Today himno for today oficio"
      | |
      | --- read: "Today read for today oficio"
      |
      | --- laudes (collection)
      | |
      | --- 03070101 (documents)
      | |
      | --- himno: "Today himno for today laudes"
      | |
      | --- read: "Today read for today laudes"
      |
      | --- 03070102 (documents)
      | |
      | --- himno: "Today himno for today laudes"
      | |
      | --- read: "Today read for today laudes"
      |
      | --- 09070325 (documents)
      | |
      | --- himno: "Today himno for today laudes"
      | |
      | --- read: "Today read for today laudes"


      In oficio or in laudes there are documents with fixed content, this content never change, and I need to use that content according to the date.



      For example:



      I have any date, on this date, one entire content is needed. For example, when I need to show the today content for oficio (or for laudes):



      • For 2019-03-25 i will need the content of 09070325


      • For 2019-03-26 i will need the content of 03070102



        ...



      • For 2020-03-25 i will need the content of 09070325



      • For 2020-03-26 i will need the content of 03070103



        ...



      • For 2021-03-25 i will need the content of 03070101


      I think of a structure to relate the fixed content according to the dates, but I do not know how to do it.



      In my application, the current date will be taken, and based on this data, must find the fixed content for oficio, for laudes, etc.



      For example, in 2019-03-25 and in 2020-03-25 is needed the content 09070325, but in 2021-03-25 is needed the content 03070101:



      20190325
      oficio : 09070325
      laudes : 09070325

      20190326
      oficio : 03070102
      laudes : 03070102

      20200325
      oficio : 03070101
      laudes : 03070101

      20210325
      oficio : 03070101
      laudes : 03070101


      How can I organize my data structure to:



      • not having to update the fixed content documents

      • put in relation the fixed content with the dates each year

      • obtain the fixed content according to a given date consuming the least amount of resources









      share|improve this question
















      I don't know how I can achieve this data structure in Firestore.



      I have this structure:



      Firestore-root
      |
      --- liturgia (collection)
      | |
      | --- lh (documents)
      | |
      | --- oficio (collection)
      | |
      | --- 03070101 (documents)
      | |
      | --- himno: "Today himno for today oficio"
      | |
      | --- read: "Today read for today oficio"
      |
      | --- 03070102 (documents)
      | |
      | --- himno: "Today himno for today oficio"
      | |
      | --- read: "Today read for today oficio"
      |
      | --- 09070325 (documents)
      | |
      | --- himno: "Today himno for today oficio"
      | |
      | --- read: "Today read for today oficio"
      |
      | --- laudes (collection)
      | |
      | --- 03070101 (documents)
      | |
      | --- himno: "Today himno for today laudes"
      | |
      | --- read: "Today read for today laudes"
      |
      | --- 03070102 (documents)
      | |
      | --- himno: "Today himno for today laudes"
      | |
      | --- read: "Today read for today laudes"
      |
      | --- 09070325 (documents)
      | |
      | --- himno: "Today himno for today laudes"
      | |
      | --- read: "Today read for today laudes"


      In oficio or in laudes there are documents with fixed content, this content never change, and I need to use that content according to the date.



      For example:



      I have any date, on this date, one entire content is needed. For example, when I need to show the today content for oficio (or for laudes):



      • For 2019-03-25 i will need the content of 09070325


      • For 2019-03-26 i will need the content of 03070102



        ...



      • For 2020-03-25 i will need the content of 09070325



      • For 2020-03-26 i will need the content of 03070103



        ...



      • For 2021-03-25 i will need the content of 03070101


      I think of a structure to relate the fixed content according to the dates, but I do not know how to do it.



      In my application, the current date will be taken, and based on this data, must find the fixed content for oficio, for laudes, etc.



      For example, in 2019-03-25 and in 2020-03-25 is needed the content 09070325, but in 2021-03-25 is needed the content 03070101:



      20190325
      oficio : 09070325
      laudes : 09070325

      20190326
      oficio : 03070102
      laudes : 03070102

      20200325
      oficio : 03070101
      laudes : 03070101

      20210325
      oficio : 03070101
      laudes : 03070101


      How can I organize my data structure to:



      • not having to update the fixed content documents

      • put in relation the fixed content with the dates each year

      • obtain the fixed content according to a given date consuming the least amount of resources






      java android firebase google-cloud-firestore






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 9:43









      Alex Mamo

      50.9k83169




      50.9k83169










      asked Mar 24 at 21:45









      A. CedanoA. Cedano

      163118




      163118






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The simplest solution I can think of is to use a date property of type String for each of your documents and simplify your structure a little bit. So a possible structure might be:



          Firestore-root
          |
          --- liturgia (collection)
          |
          --- 03070101 (document)
          |
          --- himno: "Today himno for today oficio"
          |
          --- read: "Today read for today oficio"
          |
          --- date: "20190325"
          |
          --- length: "1h"


          To get today's document, simply use the following query:



          FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
          CollectionReference liturgiaRef = rootRef.collection("liturgia");
          Query query = liturgiaRef.whereEqualTo("date", today);


          In which today is 20190325. That's it!



          Edit:



          According to your comment, instead of storing the data as date: "20190325" store it only as date: "0325". This means that you can query according to the month and day no matter what the year is. In this case, today is only 0325. This way it will work for evey year.



          Edit2:



          According to OP's comments, we agree that a possible solution would be to create a calendar node that relates the dates and the contents.






          share|improve this answer

























          • Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

            – A. Cedano
            Mar 25 at 10:19











          • If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

            – Alex Mamo
            Mar 25 at 10:26












          • Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

            – A. Cedano
            Mar 25 at 10:34












          • In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

            – Alex Mamo
            Mar 25 at 10:57











          • I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

            – A. Cedano
            Mar 25 at 11:01












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328883%2fhow-to-organize-related-temporal-and-fixed-data-in-firestore%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The simplest solution I can think of is to use a date property of type String for each of your documents and simplify your structure a little bit. So a possible structure might be:



          Firestore-root
          |
          --- liturgia (collection)
          |
          --- 03070101 (document)
          |
          --- himno: "Today himno for today oficio"
          |
          --- read: "Today read for today oficio"
          |
          --- date: "20190325"
          |
          --- length: "1h"


          To get today's document, simply use the following query:



          FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
          CollectionReference liturgiaRef = rootRef.collection("liturgia");
          Query query = liturgiaRef.whereEqualTo("date", today);


          In which today is 20190325. That's it!



          Edit:



          According to your comment, instead of storing the data as date: "20190325" store it only as date: "0325". This means that you can query according to the month and day no matter what the year is. In this case, today is only 0325. This way it will work for evey year.



          Edit2:



          According to OP's comments, we agree that a possible solution would be to create a calendar node that relates the dates and the contents.






          share|improve this answer

























          • Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

            – A. Cedano
            Mar 25 at 10:19











          • If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

            – Alex Mamo
            Mar 25 at 10:26












          • Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

            – A. Cedano
            Mar 25 at 10:34












          • In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

            – Alex Mamo
            Mar 25 at 10:57











          • I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

            – A. Cedano
            Mar 25 at 11:01
















          1














          The simplest solution I can think of is to use a date property of type String for each of your documents and simplify your structure a little bit. So a possible structure might be:



          Firestore-root
          |
          --- liturgia (collection)
          |
          --- 03070101 (document)
          |
          --- himno: "Today himno for today oficio"
          |
          --- read: "Today read for today oficio"
          |
          --- date: "20190325"
          |
          --- length: "1h"


          To get today's document, simply use the following query:



          FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
          CollectionReference liturgiaRef = rootRef.collection("liturgia");
          Query query = liturgiaRef.whereEqualTo("date", today);


          In which today is 20190325. That's it!



          Edit:



          According to your comment, instead of storing the data as date: "20190325" store it only as date: "0325". This means that you can query according to the month and day no matter what the year is. In this case, today is only 0325. This way it will work for evey year.



          Edit2:



          According to OP's comments, we agree that a possible solution would be to create a calendar node that relates the dates and the contents.






          share|improve this answer

























          • Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

            – A. Cedano
            Mar 25 at 10:19











          • If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

            – Alex Mamo
            Mar 25 at 10:26












          • Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

            – A. Cedano
            Mar 25 at 10:34












          • In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

            – Alex Mamo
            Mar 25 at 10:57











          • I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

            – A. Cedano
            Mar 25 at 11:01














          1












          1








          1







          The simplest solution I can think of is to use a date property of type String for each of your documents and simplify your structure a little bit. So a possible structure might be:



          Firestore-root
          |
          --- liturgia (collection)
          |
          --- 03070101 (document)
          |
          --- himno: "Today himno for today oficio"
          |
          --- read: "Today read for today oficio"
          |
          --- date: "20190325"
          |
          --- length: "1h"


          To get today's document, simply use the following query:



          FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
          CollectionReference liturgiaRef = rootRef.collection("liturgia");
          Query query = liturgiaRef.whereEqualTo("date", today);


          In which today is 20190325. That's it!



          Edit:



          According to your comment, instead of storing the data as date: "20190325" store it only as date: "0325". This means that you can query according to the month and day no matter what the year is. In this case, today is only 0325. This way it will work for evey year.



          Edit2:



          According to OP's comments, we agree that a possible solution would be to create a calendar node that relates the dates and the contents.






          share|improve this answer















          The simplest solution I can think of is to use a date property of type String for each of your documents and simplify your structure a little bit. So a possible structure might be:



          Firestore-root
          |
          --- liturgia (collection)
          |
          --- 03070101 (document)
          |
          --- himno: "Today himno for today oficio"
          |
          --- read: "Today read for today oficio"
          |
          --- date: "20190325"
          |
          --- length: "1h"


          To get today's document, simply use the following query:



          FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
          CollectionReference liturgiaRef = rootRef.collection("liturgia");
          Query query = liturgiaRef.whereEqualTo("date", today);


          In which today is 20190325. That's it!



          Edit:



          According to your comment, instead of storing the data as date: "20190325" store it only as date: "0325". This means that you can query according to the month and day no matter what the year is. In this case, today is only 0325. This way it will work for evey year.



          Edit2:



          According to OP's comments, we agree that a possible solution would be to create a calendar node that relates the dates and the contents.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 11:10

























          answered Mar 25 at 9:42









          Alex MamoAlex Mamo

          50.9k83169




          50.9k83169












          • Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

            – A. Cedano
            Mar 25 at 10:19











          • If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

            – Alex Mamo
            Mar 25 at 10:26












          • Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

            – A. Cedano
            Mar 25 at 10:34












          • In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

            – Alex Mamo
            Mar 25 at 10:57











          • I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

            – A. Cedano
            Mar 25 at 11:01


















          • Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

            – A. Cedano
            Mar 25 at 10:19











          • If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

            – Alex Mamo
            Mar 25 at 10:26












          • Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

            – A. Cedano
            Mar 25 at 10:34












          • In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

            – Alex Mamo
            Mar 25 at 10:57











          • I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

            – A. Cedano
            Mar 25 at 11:01

















          Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

          – A. Cedano
          Mar 25 at 10:19





          Alex thanks for your response. Why you add one field called lenght with the value: lh? The lh node is one part of liturgia. Your solution is great but i think to maintain each node updated each year (i will be need the 03070101 document at 20210325 but at 2019 and 2020i will be need 09070325). Another solution i think now is maintain one calendar node with each date and the related document. I can have this calendar node synched with the app and save this info as JSON in the app. Then i can read this JSON to take the reference of each day.

          – A. Cedano
          Mar 25 at 10:19













          If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

          – Alex Mamo
          Mar 25 at 10:26






          If 1h is mandatory you can get back and use a schema with a collection and a subcollection. Yes, you right, it's hard to maintain every year. For that, please see my updated answer.

          – Alex Mamo
          Mar 25 at 10:26














          Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

          – A. Cedano
          Mar 25 at 10:34






          Alex the problem is not the year only, if you read at end of my question i show some use cases: in 2019-03-25 and in 2020-03-25 i will be need the content of 09010325 document, but in 2021-03-25 i will be need the content of 03070101 I don't know if it's clair: the content is always the same, but depending of the year i can need different content for one day. For that i think to store the fixed content (and not update this never) and maintain another node (as a calendar) to manage the relations for each date.

          – A. Cedano
          Mar 25 at 10:34














          In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

          – Alex Mamo
          Mar 25 at 10:57





          In that case you should use (as you say a calendar) and for each document store a reference to the correct document.

          – Alex Mamo
          Mar 25 at 10:57













          I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

          – A. Cedano
          Mar 25 at 11:01






          I think that is the simplest solution. I have one doubt about this, i don't know if is subject for another question. If i decided this solution and i create one node calendar that i sync with mi App to store this data off-line, each time one user read this content (off-line) that is count as one connection and read to be billed? I try to avoid two connections for obtain the content.

          – A. Cedano
          Mar 25 at 11:01




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328883%2fhow-to-organize-related-temporal-and-fixed-data-in-firestore%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript