append #
Appends a value to a key. If the key does not exist, it is created.
append(key, value, [options], [callback]) #
Arguments | Type | Description |
---|---|---|
key | string | Key identifier |
value | string | Value to append to the key |
options | JSON Object | Optional parameters |
callback | function | Callback |
Options #
Option | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
Return Value #
Returns the MemoryStorage
object to allow chaining.
Callback Response #
Return an integer containing the new length of the key's value.
Usage #
// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.append('key', 'value', function (err, newLength) {
// callback called once the action has completed
});
// Using promises (NodeJS only)
kuzzle.memoryStorage.appendPromise('key', 'value')
.then(newLength => {
// resolved once the action has completed
});
Callback response:
5
Edit this page on Github(opens new window)