Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Collection<T, P>

Firestorm representation of a collection reference.

Type parameters

  • T: Entity

    The entity for the collection documents.

  • P: Entity

    The entity for the collection parent.

Hierarchy

  • Collection

Implements

Index

Constructors

Accessors

Methods

Constructors

constructor

  • Create a collection reference from an Entity and optional parent.

    Parameters

    • E: object

      The entity class for the collections documents.

    • Optional parent: IDocumentRef<P>

      The parent document for the collection.

    Returns Collection

Accessors

native

  • get native(): CollectionReference
  • The native firestore collection reference.

    Returns CollectionReference

parent

path

  • get path(): string

Methods

create

  • create(entity: T): Promise<T | null>
  • Creates a new document from an entity instance.

    Parameters

    • entity: T

      An instance of the entity.

    Returns Promise<T | null>

    The created entity.

doc

find

  • Finds a list of documents based on a criteria.

    deprecated

    since v1.1, use query() method to build queries instead.

    Parameters

    Returns Promise<T[]>

    A list of entities matching the criteria.

get

  • get(id: string): Promise<T | null>
  • Gets a document with a provided ID

    Parameters

    • id: string

      The ID of the document.

    Returns Promise<T | null>

    The entity.

query

remove

  • remove(id: string): Promise<void>
  • Removes a document from the collection.

    Parameters

    • id: string

      The document ID to remove.

    Returns Promise<void>

update

  • update(entity: T): Promise<T | null>
  • Updates a document from an entity instance.

    Parameters

    • entity: T

      The entity (with ID) to update.

    Returns Promise<T | null>

    The updated entity.

Generated using TypeDoc