A Collection of Folder documents within a Compendium pack.

Hierarchy (view full)

Properties

pack: CompendiumPack

The CompendiumPack instance which contains this CompendiumFolderCollection

apps: Application[]

An Array of application references which will be automatically updated when the collection content changes

invalidDocumentIds: Set<string> = ...

Record the set of document ids where the Document was not initialized because of invalid source data

documentName: string

The base Document type which is contained within this DocumentCollection

Accessors

  • get documentName(): string
  • Returns string

    Inherit Doc

  • get documentClass(): typeof Document
  • A reference to the Document class definition which is contained within this DocumentCollection.

    Returns typeof Document

  • get name(): string
  • The Collection class name

    Returns string

Methods

  • Update all objects in this DocumentCollection with a provided transformation. Conditionally filter to only apply to Entities which match a certain condition.

    Parameters

    • transformation: any

      An object of data or function to apply to all matched objects

    • condition: any = null

      A function which tests whether to target each object

    • options: {} = {}

      Additional options passed to Document.updateDocuments

      Returns Promise<Document[]>

      An array of updated data once the operation is complete

    • Instantiate a Document for inclusion in the Collection.

      Parameters

      • data: object

        The Document data.

      • Optional context: object = {}

        Document creation context.

      Returns Document

    • Obtain a temporary Document instance for a document id which currently has invalid source data.

      Parameters

      • id: string

        A document ID with invalid source data.

      • Optional options: {
            strict: boolean;
        } = {}

        Additional options to configure retrieval.

        • strict: boolean

          Throw an Error if the requested ID is not in the set of invalid IDs for this collection.

      Returns Document

      An in-memory instance for the invalid Document

      Throws

      If strict is true and the requested ID is not in the set of invalid IDs for this collection.

    • Get an element from the DocumentCollection by its ID.

      Parameters

      • id: string

        The ID of the Document to retrieve.

      • Optional options: {
            strict: boolean;
            invalid: boolean;
        } = {}

        Additional options to configure retrieval.

        • strict: boolean

          Throw an Error if the requested Document does not exist.

        • invalid: boolean

          Allow retrieving an invalid Document.

      Returns Document

      Throws

      If strict is true and the Document cannot be found.

    • Parameters

      • id: any
      • document: any

      Returns void

      Inherit Doc

    • Find all Documents which match a given search term using a full-text search against their indexed HTML fields and their name. If filters are provided, results are filtered to only those that match the provided values.

      Parameters

      • search: {
            query: string;
            filters: FieldFilter[];
            exclude: string[];
        }

        An object configuring the search

        • query: string

          A case-insensitive search string

        • filters: FieldFilter[]

          An array of filters to apply

        • exclude: string[]

          An array of document IDs to exclude from search results

      Returns string[]

    • Internal

      Follow-up actions to take when a database operation modifies Documents in this DocumentCollection.

      Parameters

      • action: DatabaseAction

        The database action performed

      • documents: ClientDocument[]

        The array of modified Documents

      • result: any[]

        The result of the database operation

      • operation: DatabaseOperation

        Database operation details

      • user: User

        The User who performed the operation

      Returns void

    • Get the searchable fields for a given document or index, based on its data model

      Parameters

      • documentName: string

        The document type name

      • Optional documentSubtype: string = ""

        The document subtype name

      • Optional isEmbedded: boolean = false

        Whether the document is an embedded object

      Returns Set<string>

      The dot-delimited property paths of searchable fields