Skip to main content

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, 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 "email" property equal to "jane.doe@xyz.com":


[{
"DeleteEntity": {
"with_class": "Animal",
"constraints": {
"species": ["==", "Mammal"]
}
}
}]

Successful response:


[{
"DeleteEntity": {
"status": 0,
"count": 1
}
}]

Delete entities of the class "Patient" with "firstname" property equal to "Alice" and connected to entities of class "Visit" with "billing_id" value set to 122:


[{
"FindEntity": {
"_ref": 1,
"with_class": "Visit",
"constraints": {
"billing_id": ["==", 125]
}
}
}, {
"FindEntity": {
"_ref": 2,
"with_class": "Patient",
"constraints": {
"firstname": ["==", "Bob"]
},
"is_connected_to": {
"ref": 1
}
}
}, {
"DeleteEntity": {
"ref": 2
}
}]

Successful response:


[{
"FindEntity": {
"returned": 0,
"status": 0
}
}, {
"FindEntity": {
"returned": 0,
"status": 0
}
}, {
"DeleteEntity": {
"status": 0,
"count": 1
}
}]