Back
delete()
Deletes the object, which means the row is deleted from the database (unless prevented by a beforeDelete
callback).
Returns true
on successful deletion of the row, false
otherwise.
// Get a post object and then delete it from the database.
post = model("post").findByKey(33);
post.delete();
// If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `deleteComment` method below will call `comment.delete()` internally.)
post = model("post").findByKey(params.postId);
comment = model("comment").findByKey(params.commentId);
post.deleteComment(comment);
Copied!