Constructor
new MongoDBStoragePlugin(dbUri, dbNameopt, collectionNameopt)
- Description:
- Source:
- Implements:
Parameters:
Name |
Type |
Attributes |
Description |
dbUri |
String
|
|
A MongoDB connection URI, such as mongodb://localhost . |
dbName |
String
|
<optional>
|
The name of the database to use or create,
such as monochromepersistence (the default). |
collectionName |
String
|
<optional>
|
The name of the collection to use or create,
such as monochromepersistence (the default). |
Methods
(async) clear()
- Description:
- Clear ALL data from storage.
- Source:
- Implements:
(async) close()
- Description:
- Finish all operations and close down. Reads and writes
may or may not be accepted after this function is called.
- Source:
- Implements:
(async) deleteKey(key)
- Description:
- Delete the value associated with the given key, clearing it from persistence.
If the key already wasn't present, this won't throw.
- Source:
- Implements:
Parameters:
Name |
Type |
Description |
key |
String
|
The key. |
(async) editValue(key, editFn, defaultValueopt) → {*}
- Description:
- Update the value associated with the given key.
- Source:
- Implements:
Parameters:
Name |
Type |
Attributes |
Description |
key |
String
|
|
The key. |
editFn |
function
|
|
A (async or sync) function that takes one argument (the current value
retrieved from storage for the given key) and returns the updated value. |
defaultValue |
*
|
<optional>
|
The default value to pass into the editFn
if no value is present for that key. |
Returns:
The updated value.
-
Type
-
*
(async) getValue(key, defaultValueopt) → {*}
- Description:
- Get the value associated with the given key.
- Source:
- Implements:
Parameters:
Name |
Type |
Attributes |
Description |
key |
String
|
|
The key. |
defaultValue |
*
|
<optional>
|
The default value if no value is present for that key. |
Returns:
The value present in storage,
or the default value if no value is present in storage.
-
Type
-
*