SDK Javascript v5.x

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] (opens new window)

hmset(key, entries, [options], [callback]) #

Arguments Type Description
key string Key identifier
entries array List of fields to add, with their value. Each entry is described by a JSON object containing the following properties:
field (field name), value (field's value)
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 #

Returns null if successful.

Usage #

Copied to clipboard!
var entries = [
  {"field": "field1", "value": "foo"},
  {"field": "field2", "value": "bar"},
  {"field": "...", "value": "..."}
// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.hmset('key', entries, function (err) {
  // callback called once the action has completed
// Using promises (NodeJS only)
kuzzle.memoryStorage.hmsetPromise('key', entries)
  .then(() => {
    // resolved once the action has completed