Firestore Query Date RangeFirestore Query/PerformanceComplex Queries in Firestore / Realtime database and modeling for queryingQuery specific day in FirestoreFirestore multiple range queryFirestore data structure to support “querying” overlapping rangesHow to do a timestamp query in FirestoreFiltering By Date Given Google Firestore SwiftWhy are 'not equals' queries in firestore not supported/hard to implement?Firestore query by dates and times separatelyFirestore range query on map field

Shortest hex dumping program

What was the definition of "set" that resulted in Russell's Paradox

How to md5 a list of filepaths contained in a file?

How do I set up a beta channel for my Steam game?

For a hashing function like MD5, how similar can two plaintext strings be and still generate the same hash?

If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?

Keep milk (or milk alternative) for a day without a fridge

Is there a way to know which symbolic expression mathematica used

Combining latex input and sed

How do you move up one folder in Finder?

Is there any word for "disobedience to God"?

Do you know your 'KVZ's?

Credit score and financing new car

Is a 10th-level Transmutation wizard considered a shapechanger for the purpose of effects such as Moonbeam?

How to convert a file with several spaces into a tab-delimited file?

Single word for "refusing to move to next activity unless present one is completed."

Meat Substitutes

Why do players in the past play much longer tournaments than today's top players?

Why presheaves are generalized objects?

How to properly say "bail on somebody" in German?

How did the hit man miss?

Graduate student with abysmal English writing skills, how to help

US Civil War story: man hanged from a bridge

Is "I do not want you to go nowhere" a case of "DOUBLE-NEGATIVES" as claimed by Grammarly?



Firestore Query Date Range


Firestore Query/PerformanceComplex Queries in Firestore / Realtime database and modeling for queryingQuery specific day in FirestoreFirestore multiple range queryFirestore data structure to support “querying” overlapping rangesHow to do a timestamp query in FirestoreFiltering By Date Given Google Firestore SwiftWhy are 'not equals' queries in firestore not supported/hard to implement?Firestore query by dates and times separatelyFirestore range query on map field






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a date range on my documents (using date objects) something like this




start: March 5
end: April 7



I'm trying to figure out how I would build a query to return all events which cover a specific day, for example March 27, so like....



A query that says something like get all documents whose starting date is before march 27th, and the ending date is after march 27th but it looks like this may not be possible with the Firestore query limitations.



So I have been scratching my head for hours to either build a query for this, or structure my data in some way which would allow this.



Is this even possible?










share|improve this question






















  • It is possible in Firestore but please add a screenshot of your real database.

    – Alex Mamo
    Mar 26 at 9:12

















0















I have a date range on my documents (using date objects) something like this




start: March 5
end: April 7



I'm trying to figure out how I would build a query to return all events which cover a specific day, for example March 27, so like....



A query that says something like get all documents whose starting date is before march 27th, and the ending date is after march 27th but it looks like this may not be possible with the Firestore query limitations.



So I have been scratching my head for hours to either build a query for this, or structure my data in some way which would allow this.



Is this even possible?










share|improve this question






















  • It is possible in Firestore but please add a screenshot of your real database.

    – Alex Mamo
    Mar 26 at 9:12













0












0








0


1






I have a date range on my documents (using date objects) something like this




start: March 5
end: April 7



I'm trying to figure out how I would build a query to return all events which cover a specific day, for example March 27, so like....



A query that says something like get all documents whose starting date is before march 27th, and the ending date is after march 27th but it looks like this may not be possible with the Firestore query limitations.



So I have been scratching my head for hours to either build a query for this, or structure my data in some way which would allow this.



Is this even possible?










share|improve this question














I have a date range on my documents (using date objects) something like this




start: March 5
end: April 7



I'm trying to figure out how I would build a query to return all events which cover a specific day, for example March 27, so like....



A query that says something like get all documents whose starting date is before march 27th, and the ending date is after march 27th but it looks like this may not be possible with the Firestore query limitations.



So I have been scratching my head for hours to either build a query for this, or structure my data in some way which would allow this.



Is this even possible?







google-cloud-firestore querying






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 2:07









Jus10Jus10

2,4143 gold badges23 silver badges52 bronze badges




2,4143 gold badges23 silver badges52 bronze badges












  • It is possible in Firestore but please add a screenshot of your real database.

    – Alex Mamo
    Mar 26 at 9:12

















  • It is possible in Firestore but please add a screenshot of your real database.

    – Alex Mamo
    Mar 26 at 9:12
















It is possible in Firestore but please add a screenshot of your real database.

– Alex Mamo
Mar 26 at 9:12





It is possible in Firestore but please add a screenshot of your real database.

– Alex Mamo
Mar 26 at 9:12












1 Answer
1






active

oldest

votes


















0














Just simply use less than and greater that query. For example in my android for snapshot listener (listening updates) app I've done something like this:



 ListenerRegistration registration;
String lessDate = "09/04/2019 23:59:59";
String greaterDate = "11/04/2019 23:59:59";
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss", Locale.getDefault());
try
Date lDate = dateFormat.parse(lessDate);
Date gDate = dateFormat.parse(greaterDate);
Query q = db.collection("collection").whereGreaterThan("createdAt", new Timestamp(lDate))
.whereLessThan("createdAt", new Timestamp(gDate));
registration = q.addSnapshotListener(new EventListener<QuerySnapshot>()
@Override
public void onEvent(@Nullable QuerySnapshot value,
@Nullable FirebaseFirestoreException e)
if (e != null)
Log.i("FIRESTORE ERROR", "Listen failed.", e);
return;

for (DocumentChange doc : value.getDocumentChanges())
// What ever you want to do.


);
catch (ParseException e)
e.printStackTrace();



For dates, you can actually get a date from the system or take input from the user and customize it according to your need. Let me know if you need any help.






share|improve this answer






















    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%2f55348853%2ffirestore-query-date-range%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









    0














    Just simply use less than and greater that query. For example in my android for snapshot listener (listening updates) app I've done something like this:



     ListenerRegistration registration;
    String lessDate = "09/04/2019 23:59:59";
    String greaterDate = "11/04/2019 23:59:59";
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss", Locale.getDefault());
    try
    Date lDate = dateFormat.parse(lessDate);
    Date gDate = dateFormat.parse(greaterDate);
    Query q = db.collection("collection").whereGreaterThan("createdAt", new Timestamp(lDate))
    .whereLessThan("createdAt", new Timestamp(gDate));
    registration = q.addSnapshotListener(new EventListener<QuerySnapshot>()
    @Override
    public void onEvent(@Nullable QuerySnapshot value,
    @Nullable FirebaseFirestoreException e)
    if (e != null)
    Log.i("FIRESTORE ERROR", "Listen failed.", e);
    return;

    for (DocumentChange doc : value.getDocumentChanges())
    // What ever you want to do.


    );
    catch (ParseException e)
    e.printStackTrace();



    For dates, you can actually get a date from the system or take input from the user and customize it according to your need. Let me know if you need any help.






    share|improve this answer



























      0














      Just simply use less than and greater that query. For example in my android for snapshot listener (listening updates) app I've done something like this:



       ListenerRegistration registration;
      String lessDate = "09/04/2019 23:59:59";
      String greaterDate = "11/04/2019 23:59:59";
      SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss", Locale.getDefault());
      try
      Date lDate = dateFormat.parse(lessDate);
      Date gDate = dateFormat.parse(greaterDate);
      Query q = db.collection("collection").whereGreaterThan("createdAt", new Timestamp(lDate))
      .whereLessThan("createdAt", new Timestamp(gDate));
      registration = q.addSnapshotListener(new EventListener<QuerySnapshot>()
      @Override
      public void onEvent(@Nullable QuerySnapshot value,
      @Nullable FirebaseFirestoreException e)
      if (e != null)
      Log.i("FIRESTORE ERROR", "Listen failed.", e);
      return;

      for (DocumentChange doc : value.getDocumentChanges())
      // What ever you want to do.


      );
      catch (ParseException e)
      e.printStackTrace();



      For dates, you can actually get a date from the system or take input from the user and customize it according to your need. Let me know if you need any help.






      share|improve this answer

























        0












        0








        0







        Just simply use less than and greater that query. For example in my android for snapshot listener (listening updates) app I've done something like this:



         ListenerRegistration registration;
        String lessDate = "09/04/2019 23:59:59";
        String greaterDate = "11/04/2019 23:59:59";
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss", Locale.getDefault());
        try
        Date lDate = dateFormat.parse(lessDate);
        Date gDate = dateFormat.parse(greaterDate);
        Query q = db.collection("collection").whereGreaterThan("createdAt", new Timestamp(lDate))
        .whereLessThan("createdAt", new Timestamp(gDate));
        registration = q.addSnapshotListener(new EventListener<QuerySnapshot>()
        @Override
        public void onEvent(@Nullable QuerySnapshot value,
        @Nullable FirebaseFirestoreException e)
        if (e != null)
        Log.i("FIRESTORE ERROR", "Listen failed.", e);
        return;

        for (DocumentChange doc : value.getDocumentChanges())
        // What ever you want to do.


        );
        catch (ParseException e)
        e.printStackTrace();



        For dates, you can actually get a date from the system or take input from the user and customize it according to your need. Let me know if you need any help.






        share|improve this answer













        Just simply use less than and greater that query. For example in my android for snapshot listener (listening updates) app I've done something like this:



         ListenerRegistration registration;
        String lessDate = "09/04/2019 23:59:59";
        String greaterDate = "11/04/2019 23:59:59";
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss", Locale.getDefault());
        try
        Date lDate = dateFormat.parse(lessDate);
        Date gDate = dateFormat.parse(greaterDate);
        Query q = db.collection("collection").whereGreaterThan("createdAt", new Timestamp(lDate))
        .whereLessThan("createdAt", new Timestamp(gDate));
        registration = q.addSnapshotListener(new EventListener<QuerySnapshot>()
        @Override
        public void onEvent(@Nullable QuerySnapshot value,
        @Nullable FirebaseFirestoreException e)
        if (e != null)
        Log.i("FIRESTORE ERROR", "Listen failed.", e);
        return;

        for (DocumentChange doc : value.getDocumentChanges())
        // What ever you want to do.


        );
        catch (ParseException e)
        e.printStackTrace();



        For dates, you can actually get a date from the system or take input from the user and customize it according to your need. Let me know if you need any help.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 12 at 14:19









        Bhavesh MisriBhavesh Misri

        1,1571 gold badge8 silver badges21 bronze badges




        1,1571 gold badge8 silver badges21 bronze badges


















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            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%2f55348853%2ffirestore-query-date-range%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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현