Skip to content

Field (NodeJS)

Dmitry Kochin edited this page Jun 22, 2018 · 1 revision

Field object represent database typed field. In Ties.DB field can contain name, type and either value or field hash. If you don't specify the field in RecollectionRequest, the field hash may be returned instead of field value.

Creating field

let field = new Field(name, type, values);

Arguments

  • name - name of the field
  • type - type of the field
  • values - an object with one or more keys:
values = {
    binaryValue: Buffer, //The binary value of the field
    value: mixed, //Javascript typed value of the field
    hash: Buffer //Hash of the field
}

If some of the keys are absent in values they will be recreated from specified keys on demand.


Getting name of the field

let name = field.getName();

Gets name of the field


Getting value of the field

let value = field.getValue();

Gets js-typed value of the field


Getting binary value of the field

let value = field.getBinaryValue();

Gets binary representation of the field value


Getting field hash

let value = field.getHash();

Gets hash of the field


Setting field value

field.setValue(value);

Sets new value of the field


Setting field value

field.setValue(value);

Sets new value of the field


Setting field binary value

field.setBinaryValue(valueBuffer);

Sets new value of the field using its binary representation

Clone this wiki locally