SDK
SDK Javascript v6.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

hmset #

Sets multiple fields at once in a hash.

[Redis documentation]

Arguments #

hmset(key, entries, [options]);

ArgumentsTypeDescription
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:

PropertiesTypeDescription
field
string
Field name
value
string
Field value

options #

The options arguments can contain the following option properties:

PropertyType (default)Description
queuable
boolean (true)
If true, queues the request during downtime, until connected to Kuzzle again

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);
}