DeleteEntity

Deletes entity objects that satisfy the specified constraints. All connections associated with the objects will also be deleted.

Parameters

  • [optional] ref: Reference to other entity objects within the transaction.
  • [optional] with_class: Specifies the entity class.
  • [optional] constraints

Details

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

If the ref parameter is used, the search results represented by the ref will not be valid for the remaining commands within the transaction.

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

Warning: Delete is an performance expensive command, as ApertureDB was designed for read intensive workloads.

Examples

Delete entity of the class “Person” with “unique_id” property equal to 22:

[ {
    "DeleteEntity": {
        "with_class": "Person",
        "constraints": {
            "unique_id": ["==", 22]
        }
    }
}]

Delete entities of the class “Person” with “unique_id” property equal to 22 and connections to entities of class “Visit” with property year before 1970:

[ {
    "FindEntity": {
        "with_class": "Visit",
        "_ref": 1,
        "constraints": {
            "year": ["==", 70]
        }
    }
}, {
    "FindEntity" : {
        "_ref": 2,
        "with_class": "Person",
        "constraints": {
            "unique_id": ["==", 22]
        },
        "is_connected_to": {
            "ref": 1,
        }
    }
}, {
    "DeleteEntity": {
        "ref": 2,
    }
}]