Type alias CollectionReference<T>

CollectionReference<T>: { id: string; parent: DocumentReference<DocumentData> | null; path: string; add: any; doc: any }

A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).

Type Parameters

Type declaration

  • Readonly id: string

    The identifier of the collection.

  • Readonly parent: DocumentReference<DocumentData> | null

    A reference to the containing Document if this is a subcollection, else null.

  • Readonly path: string

    A string representing the path of the referenced collection (relative to the root of the database).

  • add:function
    • Add a new document to this collection with the specified data, assigning it a document ID automatically.

      Returns

      A Promise resolved with a DocumentReference pointing to the newly created document after it has been written to the backend.

      Parameters

      • data: T

        An Object containing the data for the new document.

      Returns Promise<DocumentReference<T>>

  • doc:function
    • Get a DocumentReference for the document within the collection at the specified path. If documentPath is not specified, an automatically-generated unique ID will be used as the document ID.

      Returns

      The DocumentReference instance.

      Parameters

      • Optional documentPath: string

        A slash-separated path to a document.

      Returns DocumentReference<T>

Generated using TypeDoc