new GlobalMap(setup, parent)
Creates a new instance of the GlobalMap class.
Parameters:
| Name | Type | Description |
|---|---|---|
setup |
Object | The setup object. |
parent |
Object | The parent object. |
- Source:
Throws:
-
If the creation of GlobalMap fails.
- Type
- Error
Members
parent
Returns the parent object of the GlobalMap instance.
- Source:
stringIndex
Returns the string representation of the index property.
- Source:
Methods
(async) deleteDB(collectionName, filter) → {Promise.<Object>}
Asynchronously deletes the GlobalMap instance from the database.
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
string | The name of the collection to delete the instance. |
filter |
Object | The filter object for deletion. |
- Source:
Throws:
-
If there is an error during the deletion process.
- Type
- Error
Returns:
- A promise resolving to the deletion result.
- Type
- Promise.<Object>
(async) getCurrentUser() → {Promise.<Object>}
Asynchronously retrieves the current user associated with the GlobalMap instance.
- Source:
Throws:
-
If there is an error during the retrieval process.
- Type
- Error
Returns:
- A promise resolving to the current user object.
- Type
- Promise.<Object>
(async) increaseProp(propKey, value) → {Promise.<GlobalMap>}
Asynchronously increases a property value in the GlobalMap instance.
Parameters:
| Name | Type | Description |
|---|---|---|
propKey |
string | The property key to increase. |
value |
number | The value by which the property should be increased (default is 1). |
- Source:
Throws:
-
If there is an error during the property increase process.
- Type
- Error
Returns:
- A promise resolving to the updated GlobalMap instance.
- Type
- Promise.<GlobalMap>
(async) loadDB(collectionName) → {Promise.<GlobalMap>}
Asynchronously loads the GlobalMap instance from the database.
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
string | The name of the collection to load the instance. |
- Source:
Throws:
-
If there is an error during the loading process.
- Type
- Error
Returns:
- A promise resolving to the loaded GlobalMap instance.
- Type
- Promise.<GlobalMap>
(async) saveDB(collectionName) → {Promise.<GlobalMap>}
Asynchronously saves the GlobalMap instance to the database.
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
string | The name of the collection to save the instance. |
- Source:
Throws:
-
If there is an error during the saving process.
- Type
- Error
Returns:
- A promise resolving to the saved GlobalMap instance.
- Type
- Promise.<GlobalMap>
(async) setEncryptField(fieldName, value) → {Promise.<Object>}
Encrypts and sets the specified field with the provided value. If the field does not have a current encrypted value, it creates a new SafeValue instance and updates the field in the database. If the field already has an encrypted value, it updates the existing SafeValue instance with the new value.
Parameters:
| Name | Type | Description |
|---|---|---|
fieldName |
string | The name of the field to be encrypted and updated. |
value |
string | The raw value to be encrypted and set. |
- Source:
Throws:
-
If there is an error during encryption, database update, or if a required value is missing.
- Type
- Error.Log
Returns:
A Promise that resolves to an object containing success status, message, and data.
- Type
- Promise.<Object>
(async) updateDB(updateParams) → {Promise.<GlobalMap>}
Asynchronously updates the GlobalMap instance in the database.
Parameters:
| Name | Type | Description |
|---|---|---|
updateParams |
Object | The update parameters including collectionName, filter, and data. |
- Source:
Throws:
-
If there is an error during the update process.
- Type
- Error
Returns:
- A promise resolving to the updated GlobalMap instance.
- Type
- Promise.<GlobalMap>