hmset #
Sets multiple fields at once in a hash.
Arguments #
hmset(key, entries, [options]);
Arguments | Type | Description |
---|---|---|
key | string | Hash key |
entries | object[] | List of field-value pairs to set |
options | object | Optional query arguments |
entries #
The entries
array lists the fields to set in the hash. Each entry object has the following properties:
Properties | Type | Description |
---|---|---|
field | string | Field name |
value | string | Field value |
options #
The options
arguments can contain the following option properties:
Property | Type (default) | Description |
---|---|---|
queuable | boolean (true) | If true , queues the request during downtime, until connected to Kuzzle again |
[triggerEvents ](/sdk/7/core-classe | timeout | number ( -1 ) |
Resolve #
Resolves once the fields have been set.
Usage #
try {
await kuzzle.ms.hmset(
'hashfoo',
[
{field: 'key1', value: 'val1'},
{field: 'key2', value: 'val2'},
{field: 'key3', value: 'val3'}
]
);
// Prints: { key1: 'val1', key2: 'val2', key3: 'val3' }
console.log(await kuzzle.ms.hgetall('hashfoo'));
} catch (error) {
console.error(error.message);
}
Edit this page on Github(opens new window)