SubDocumentCollection<T> Class
A collection of SubDocument objects.
#Declaration
export class SubDocumentCollection<T extends SubDocument> extends Collection<T>
#Type Parameters
Name | Type | Description |
---|---|---|
T | Sub |
The type of sub-documents in the collection. |
#Inheritance
#Properties
#main Property
Returns the main sub-document.
#Declaration
get main(): T
#Property Value
Type | Description |
---|---|
T | The main sub-document. |
#Remarks
Tip
You can access the main sub-document’s properties directly at the document level.
#Methods
#forEach(callback) Method
Performs the specified action on each element of the current sub-document collection.
#Declaration
forEach(
callback: (subDocument: T) => void
): void
#Parameters
Name | Type | Description |
---|---|---|
callback | (sub |
The action to perform on each element of the collection. |
#getById(id) Method
Gets a sub-document with the specified ID.
#Declaration
getById(
id: number
): T
#Parameters
Name | Type | Description |
---|---|---|
id | number | The sub-document identifier. |
#Returns
Type | Description |
---|---|
T | A sub-document with the specified identifier. |