An array of data objects from which to create document instances
An Array of application references which will be automatically updated when the collection content changes
Record the set of document ids where the Document was not initialized because of invalid source data
Static
documentReturn an Array of all the entry values in the Collection
Return a reference to the SidebarDirectory application for this WorldCollection.
A reference to the Document class definition which is contained within this DocumentCollection.
Reference the set of Folders which contain documents in this collection
The Collection class name
Static
instanceReturn a reference to the singleton instance of this WorldCollection, or null if it has not yet been created.
Static
registeredReturn an array of currently registered sheet classes for this Document type.
Static
settingsProvide the settings object which configures the Combat document
Internal
Follow-up actions to take when a database operation modifies Documents in this DocumentCollection.
The database action performed
The array of modified Documents
The result of the database operation
Database operation details
The User who performed the operation
Then iterating over a Collection, we should iterate over its values instead of over its entries
Instantiate a Document for inclusion in the Collection.
The Document data.
Optional
context: object = {}Document creation context.
Filter the Collection, returning an Array of entries which match a functional condition.
The functional condition to test.
An Array of matched values
Find an entry in the Map using a functional condition.
The functional condition to test.
The value, if found, otherwise undefined
Apply a function to each element of the collection
A function to apply to each element
Apply data transformations when importing a Document from a Compendium pack
The source Document, or a plain data object
Optional
options: FromCompendiumOptions = {}Additional options which modify how the document is imported
The processed data ready for world Document creation
Get an element from the DocumentCollection by its ID.
The ID of the Document to retrieve.
Optional
options: { invalid?: boolean; strict?: boolean } = {}Additional options to configure retrieval.
Optional
invalid?: booleanAllow retrieving an invalid Document.
Optional
strict?: booleanThrow an Error if the requested Document does not exist.
Obtain a temporary Document instance for a document id which currently has invalid source data.
A document ID with invalid source data.
Optional
options: { strict?: boolean } = {}Additional options to configure retrieval.
Optional
strict?: booleanThrow an Error if the requested ID is not in the set of invalid IDs for this collection.
An in-memory instance for the invalid Document
Get an entry from the Collection by name. Use of this method assumes that the objects stored in the collection have a "name" attribute.
The name of the entry to retrieve
Optional
options: { strict?: boolean } = {}Additional options that affect how entries are retrieved
Optional
strict?: booleanThrow an Error if the requested name does not exist. Default false.
The retrieved entry value, if one was found, otherwise undefined
Import a Document from a Compendium collection, adding it to the current World.
The CompendiumCollection instance from which to import
The ID of the compendium entry to import
Optional
updateData: object = {}Optional additional data used to modify the imported Document before it is created
Optional
options: object = {}Optional arguments passed to the foundry.documents.abstract.WorldCollection#fromCompendium and foundry.abstract.Document.create methods
The imported Document instance
Transform each element of the Collection into a new form, returning an Array of transformed values
A transformation function applied to each entry value. Positional arguments are the value, the index of iteration, and the collection being mapped.
An Array of transformed values
Reduce the Collection by applying an evaluator function and accumulating entries
A reducer function applied to each entry value. Positional arguments are the accumulator, the value, the index of iteration, and the collection being reduced.
An initial value which accumulates with each iteration
The accumulated result
Render any Applications associated with this DocumentCollection.
Optional
force: boolean = falseForce rendering
Optional
options: object = {}Optional options
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.
An object configuring the search
Optional
exclude?: string[]An array of document IDs to exclude from search results
Optional
filters?: FieldFilter[]An array of filters to apply
Optional
query?: stringA case-insensitive search string
Test whether a condition is met by some entry in the Collection.
The functional condition to test. Positional arguments are the value, the index of iteration, and the collection being tested.
Was the test condition passed by at least one entry?
Convert the Collection to a primitive array of its contents.
An array of contained values
Update all objects in this DocumentCollection with a provided transformation. Conditionally filter to only apply to Entities which match a certain condition.
An object of data or function to apply to all matched objects
A function which tests whether to target each object
Optional
options: object = {}Additional options passed to Document.updateDocuments
An array of updated data once the operation is complete
Protected
_initializeProtected
Initialize the DocumentCollection by constructing any initially provided Document instances
Static
getGet the searchable fields for a given document or index, based on its data model
The document name
Optional
type: stringA document subtype
A record of searchable DataField definitions
Static
registerRegister a Document sheet class as a candidate which can be used to display Documents of a given type. See foundry.applications.apps.DocumentSheetConfig.registerSheet for details.
Arguments forwarded to the DocumentSheetConfig.registerSheet method
Static
unregisterUnregister a Document sheet class, removing it from the list of available sheet Applications to use. See foundry.applications.apps.DocumentSheetConfig.unregisterSheet for detauls.
Arguments forwarded to the DocumentSheetConfig.unregisterSheet method
The singleton collection of Combat documents which exist within the active World. This Collection is accessible within the Game object as game.combats.
See