Firestore Jogamais

Interact with Firestore for Joga+ app

Overview

This node interacts with Firestore for the Joga+ app, allowing users to perform various operations on Firestore collections such as retrieving documents, adding, updating, deleting documents, and specifically retrieving groups with matches scheduled within a certain draw window based on a reference date. It is useful for managing and querying Firestore data related to groups and matches in a sports or event scheduling context.

Use Case Examples

  1. Retrieve all documents from a specified Firestore collection.
  2. Add a new document with JSON data to a Firestore collection.
  3. Update or delete a specific document by its ID.
  4. Get groups that have matches scheduled within a time window starting from a reference date, useful for event scheduling or draw management.

Properties

Name Meaning
Collection The Firestore collection to operate on.
Reference Date (ISO) The ISO date-time used as a reference point for the 'Get Groups In Draw Window' operation. If empty, the current time is used.
Document ID The ID of the document to update or delete. Optional for other operations.
Data (JSON) The JSON data to write or update in the Firestore document.

Output

JSON

  • id - The document ID in Firestore.
  • groupId - The ID of the group when retrieving groups in the draw window.
    group
  • id - The ID of the group object.
    - Other fields of the group document.
  • matchId - The ID of the match within the group.
    match
  • id - The ID of the match object.
    - Other fields of the match document.
  • window
    • start - The ISO string of the start time of the draw window.
    • end - The ISO string of the end time of the draw window.
    • lockMinutes - The number of minutes before the draw window locks.
  • updated - Indicates a document was successfully updated (boolean).
  • deleted - Indicates a document was successfully deleted (boolean).

Dependencies

  • Firebase Admin SDK

Troubleshooting

  • Ensure the Firebase credentials are correctly configured and have the necessary permissions to access Firestore.
  • For the 'Get Groups In Draw Window' operation, provide a valid ISO date-time string for the reference date; otherwise, an error 'Invalid referenceDate' will be thrown.
  • Check that the collection name and document IDs are correct to avoid errors when updating or deleting documents.

Links

  • Firestore Documentation - Official documentation for Firestore, useful for understanding Firestore operations and data structure.

Discussion