Skip to content

Commit

Permalink
Update example.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jul 29, 2023
1 parent 25f3c1b commit 4e29537
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/Firestore/DataQuery/DataQuery.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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());

}
}

0 comments on commit 4e29537

Please sign in to comment.