UpdateEntity

Updates existing Entity objects that satisfy the specified constraints.

Parameters

Details

If the ref parameter is used, with_class and constraints will be ignored.

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

For more complex searches for object to delete, a Find command must be used first within the transaction.

Examples

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

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

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

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

Update all entities of the class “Person” that have the property “age” greater than 18 and that have a connection to an entity of the class “Nation”, setting their property “vaccine” to “eligible”:

[ {
    "FindEntity": {
        "with_class": "Nation",
        "_ref": 1,
        "constraints": {
            "name": "Republic of Argentina"
        }
    }
}, {
    "FindEntity": {
        "_ref": 2,
        "with_class": "Person",
        "constraints": {
            "age": [">=", 18]
        },
        "is_connected_to": {
            "ref": 1
        }
    }
}, {
    "UpdateEntity" : {
        "ref" : 2,
        "properties" : {
            "vaccine": "eligible"
        }
    }
}]