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.

bitop #

Performs a bitwise operation between multiple keys (containing string values) and stores the result in the destination key.

[Redis documentation]


bitop(key, operation, keys, [options], [callback]) #

ArgumentsTypeDescription
keystringDestination key identifier
operationstringBitwise operation to perform.
Allowed values: AND, OR, XOR, NOT
keysarraylist of source keys on which the bitwise operation will be applied
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the MemoryStorage object to allow chaining.


Callback Response #

Returns an integer containing the length of the new key's value.

Usage #

// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.bitop('key', 'AND', ['srckey1', 'srckey2', '...'], function (err, length) {
  // callback called once the action has completed
});
// Using promises (NodeJS only)
kuzzle.memoryStorage.bitopPromise('key', 'AND', ['srckey1', 'srckey2', '...'])
  .then(length => {
    // resolved once the action has completed
  });

Callback response:

42