SDK
SDK Javascript v5.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.

hscan #

Identical to scan, except that hscan iterates over the fields contained in a hash.

[Redis documentation]


hscan(key, cursor, [options], callback) #

Arguments Type Description
key string Key identifier
cursor int Page number (iteration starts with a cursor value of 0, and ends when the next cursor position is 0)
options JSON Object Optional parameters
callback function Callback

Options #

Option Type Description Default
count int Return the approximate count number of items per result page 10
match string Search only for field names matching the provided pattern *
queuable boolean Make this request queuable or not true

Callback Response #

Returns an object containing 2 entries:

  • the cursor position for the next page of results (a next position of 0 indicates the end of the scan)
  • an array of field names and values

Usage #

Copied to clipboard!
// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.hscan('key', 0, function (err, page) {
  // callback called once the action has completed
});
// Using promises (NodeJS only)
kuzzle.memoryStorage.hscanPromise('key', 0)
  .then(page => {
    // resolved once the action has completed
  });

Callback response:

Copied to clipboard!
{
  "cursor": 18,
  "values": ["field1", "field1 value", "field2", "field2 value"]
}