new Collection(setup)
Creates a new instance of the Collection class.
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setup |
Object | The setup object containing collection details and configurations. Properties
|
- Source:
Throws:
-
If collection setup fails.
- Type
- Error
Members
Model
The collection's model.
Properties:
| Type | Description |
|---|---|
| object |
- Source:
Types :mongoose.Schema.Types
Represents MongoDB schema types.
Type:
- mongoose.Schema.Types
- Source:
displayName
The display name of the collection.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
excludeGlobals
Globals to be excluded from the collection.
Properties:
| Type | Description |
|---|---|
| Array.<string> |
- Source:
fieldsSet
The fields of the collection.
Properties:
| Type | Description |
|---|---|
| Array.<CollectionField> |
- Source:
name
The name of the collection.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
pluralLabel
The plural label of the collection.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
singularLabel
The singular label of the collection.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
symbol
The symbol of the collection.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
Methods
addNewField(config)
Adds a new field to the collection.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
CollectionField | The configuration object for the new field. |
- Source:
getFieldSet(fieldName) → {CollectionField}
Gets a specific field from the collection's field set.
Parameters:
| Name | Type | Description |
|---|---|---|
fieldName |
string | The name of the field to retrieve. |
- Source:
Throws:
-
- Throws an error if field retrieval fails.
- Type
- Error.Log
Returns:
- The CollectionField object representing the specified field.
- Type
- CollectionField