Delete

Use delete methods for record removal.

delete()

ballerina
var deleted = check db.'from(User)
    .'where({id: {equals: 1}})
    .delete();

delete() returns the deleted row payload when successful.

deleteMany()

ballerina
int affected = check db.'from(User)
    .'where({status: {equals: "INACTIVE"}})
    .deleteMany();

Behavior notes

  • delete() reads the target row first, then executes delete.
  • If no row matches, the operation returns an error.
  • deleteMany() returns affected row count.

Next step

Continue with Aggregations.