UpdateEntity

Updates existing Entity objects that satisfy the specified constraints.

Parameters

  • [optional] _ref: Reference to other entities within the transaction.
  • [optional] class: name of entity class.
  • [optional] unique: Indicates whether a single object is expected to satisfy the constraints.

Blocks

Details

Either _ref OR [class and/or constraints] must be specified.

If the _ref parameter is specified, it must refers to the search results of a previous FindEntity or AddEntity.

The remove_props parameter is an array of strings specifying the properties to be deleted (if any).

If search results are empty, this will cause an exception.

Examples

Find the entity of class “Person” with a particular “email” property, and remove the “last_connected” property:

[ {
    "UpdateEntity" : {
        "class" : "Person",
        "constraints" : {
            "email": [ "==", "jane.doe@xyz.com" ],
        },
        "remove_props" : [ "last_connected" ]
    }
}]

Find the entity of class “Person” with a particular “email” property, and change/add two new properties:

[ {
    "UpdateEntity" : {
        "class" : "Person",
        "constraints" : {
            "email": [ "==", "jane.doe@xyz.com" ],
        },
        "properties" : {
            "type":     "friend",
            "year_met": 2018
        }
    }
}]