Class FirestoreCollection<T>

Type Parameters

Hierarchy

  • Collection<T, QuerySnapshot, CollectionReference<DocumentData>>
    • FirestoreCollection

Constructors

Properties

collectionMutator: CollectionMutator<QuerySnapshot<DocumentData>> = Mutators.DefaultCollectionKeyValueMutator
dbInstance: CollectionReference<DocumentData>
debug: Debugger = ...
name: string

Methods

  • The fetchNoRef() method fetch the collection from database without referable property, mutate, and then save it as a cache.

    Returns

    Promise

    Parameters

    • Optional mutator: CollectionMutator<QuerySnapshot<DocumentData>> = ...

      Mutator mutates raw collection data from the database to certain format check Mutator for some built-in mutators.

    Returns Promise<LiveDMap<string, T[keyof T]>>

  • The handleChanges() abstract method will be used to handle DataChanges to match the database required form. Note: Different databases require different procedures to process DataChanges.

    Abstract

    Parameters

    • changes: DataChanges[]

      Received changes.

    Returns Promise<DataChanges[]>

  • The pushChanges() method push incoming changes to the database.

    Parameters

    • changes: ChangeList

      Received changes.

    • strict: boolean = true

      Only allow LiveDMap changes to be pushed to the database.

    Returns Promise<boolean>

  • The readFromCacheNoRef() method retrieve data from saved cache without referable property.

    Parameters

    • autoFetch: boolean = false

      Automatically fetch data from the database if it is not presented.

    Returns Promise<null | DMap<string, T[keyof T]>>

  • The retrieveCollection() abstract method will be called internally to fetch collection data. Note: Different databases require different procedures to access its collection.

    Abstract

    Returns Promise<QuerySnapshot<DocumentData>>

  • The verifyChanges() abstract method will be used to verify changes pushed to the database. Note: Different databases may require different procedures.

    Abstract

    Parameters

    • changes: DataChanges[]

      Expected changes.

    Returns Promise<boolean>

Generated using TypeDoc