From 4e29537b458b7175ffdeb9b198e7f8ee56fad44f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 29 Jul 2023 13:00:03 +0700 Subject: [PATCH] Update example. --- examples/Firestore/DataQuery/DataQuery.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/Firestore/DataQuery/DataQuery.ino b/examples/Firestore/DataQuery/DataQuery.ino index 61be033d3..bcd90e409 100644 --- a/examples/Firestore/DataQuery/DataQuery.ino +++ b/examples/Firestore/DataQuery/DataQuery.ino @@ -138,7 +138,7 @@ void loop() query.set("select/fields/[1]/fieldPath", "myInteger"); // query.set("select/fields/[2]/fieldPath", "myTimestamp"); - query.set("from/collectionId", "c0"); + query.set("from/collectionId", "a0"); query.set("from/allDescendants", false); query.set("orderBy/field/fieldPath", "myInteger"); query.set("orderBy/direction", "DESCENDING"); @@ -149,9 +149,12 @@ void loop() // The arguments is the consistencyMode value, see the function description at // https://github.com/mobizt/Firebase-ESP-Client/tree/main/src#runs-a-query - if (Firebase.Firestore.runQuery(&fbdo, FIREBASE_PROJECT_ID, "" /* databaseId can be (default) or empty */, "a0/b0" /* The document path */, &query /* The FirebaseJson object holds the StructuredQuery data */)) + //Note that in this case the document path is the root ("/") because the collection a0 is at the root. + + if (Firebase.Firestore.runQuery(&fbdo, FIREBASE_PROJECT_ID, "" /* databaseId can be (default) or empty */, "/" /* The document path */, &query /* The FirebaseJson object holds the StructuredQuery data */)) Serial.printf("ok\n%s\n\n", fbdo.payload().c_str()); else Serial.println(fbdo.errorReason()); + } }