Dalmart
    Preparing search index...

    Interface IZDatabaseDocument

    Represents a set of database operations for a document database.

    interface IZDatabaseDocument {
        count(
            source: string | IZDatabaseDocumentCollection,
            scope?: IZFilter,
        ): Promise<number>;
        create<T>(source: string, template: T[]): Promise<T[]>;
        delete(source: string, scope?: IZFilter): Promise<number>;
        read<T>(
            source: string | IZDatabaseDocumentCollection,
            request?: IZDataRequest,
        ): Promise<T[]>;
        update<T>(
            source: string,
            template: Partial<T>,
            scope?: IZFilter,
        ): Promise<number>;
    }

    Implemented by

    Index

    Methods

    • Retrieves the count of documents from the source.

      Parameters

      • source: string | IZDatabaseDocumentCollection

        The source collection to count.

      • Optionalscope: IZFilter

        The data scope. If this is undefined, then the total number of documents in the database should be returned.

      Returns Promise<number>

      The total source count.

    • Inserts many documents in the database.

      Type Parameters

      • T

      Parameters

      • source: string

        The source to create into.

      • template: T[]

        The template documents.

      Returns Promise<T[]>

      A list of matching documents that have been inserted into the database.

    • Deletes documents from the database.

      Parameters

      • source: string

        The source to delete from.

      • Optionalscope: IZFilter

        The scope of data to delete.

      Returns Promise<number>

      The total number of documents deleted.

    • Reads documents from the database.

      Type Parameters

      • T

      Parameters

      • source: string | IZDatabaseDocumentCollection

        The source collection to read from.

      • Optionalrequest: IZDataRequest

        The request scope. If this is undefined, then all documents are read from the database.

      Returns Promise<T[]>

      A page of documents that match the request scope.

    • Updates fields in the database.

      Type Parameters

      • T

      Parameters

      • source: string

        The source to update.

      • template: Partial<T>

        The partial template that contains the fields to update.

      • Optionalscope: IZFilter

        The scope to filter to. If this is undefined, then all documents are updated.

      Returns Promise<number>

      The total number of documents updated.